How can I handle InputScope="Number" data ( XAML)? - c#

I 've created 3 text box with input scope = "number " one for the day , one for the mounth and one for the year - I want to nd also verify that the input is corect , how can i do this ? Iimagine from c#...

first you can refer to the code of Microsoft.Phone.Controls.Toolkit 's DatePick
second if you just want to handle this in a easy way, + event of textChanged
and check your textbox 's value

Related

How to change textbox value by selecting suggested value?

I'm creating a Desktop App in Visual Studio With C#.
I've a String array called Tag_Word_Box. In a textbox if I type something, then it will be show suggest words from Tag_Word_Box array.
In briefly, assume that- I've 5 words respectively [aabc] [abc] [abd] [abcg] [bcd] If I type in textbox only 'a' then it will be show all of words without 'bcd'.
If I select 'aabc' or press enter one of suggesting words, then- it will be assign whole word in textbox, that means textbox value will be changed with selecting word by 'a'.
BTW, I know that- it will be solved by trie algorithm to find out words. But I want to know that how to do that operation in visual studio respect of C# that-
1. to show suggesting words when I type something
2. and how do I change textbox value by selecting from those?
Thanks :)
All textboxs have an 'AutoCompleteSource' property. Set it to CustomSource from the Properties toolbar. Then set the 'AutoCompleteMode' property to SuggestAppend. Now, in the code, add this to the TextChanged Event of the textbox:
var autocomplete = new AutoCompleteStringCollection();
autocomplete.AddRange(Tag_Word_Box);
textBoxName.AutoCompleteCustomSource = autocomplete;
To do the complete thing in code, add this to the TextChanged event of your textbox:
textBoxName.AutoCompleteSource=AutoCompleteSource.CustomSource;
textBoxName.AutoCompleteMode=AutoCompleteMode.SuggestAppend;
var autocomplete = new AutoCompleteStringCollection();
autocomplete.AddRange(Tag_Word_Box);
textBoxName.AutoCompleteCustomSource = autocomplete;
Remember to replace textBoxName by the name of your textbox before using this code.

Text Box Text From Local database on WP8.1 Visual studio c#

Good Day!. I am trying for retrieving Local database values and showing into textBox.!
I have to put a very long text on a " textbox " , and I need a local database to read the text to be put into the text box .
How do I enter text inside the database ? how do we associate the text to textbox ?
I'm looking for a simple example , which only this , a textbox and a database.Ho found tutorials but are dispersive
you must first look at the 31 days of Mango, specially the day #30

Get position of selected text in string in textbox

Ok, I'm trying to do something a little specific here. I want to get the location of the selected text in a textbox.
To elaborate- I can use location to select text. If I have a textBox1 I could do:
textBox1.SelectionStart = 1;
textBox1.SelectionLength = 4;
That would start at the second letter and select 4 letters.
What I want to do is the opposite: when the user selects text, I want to find out what the start is and what the length is (or what the start is and what the end is. Either will work).
I thought about just searching the string for the selectedtext (textBox1.SelectedText). The problem comes if it is a common word or a string that is used multiple times. For instance.
This is a cat. This is a cat. This is a cat.
If they select the second sentence, using SelectedText to search the string for that specific sentence does me no good. It could be either of the 3.
So, my question is: When the user clicks a button, how do I determine the exact elements that are selected by the user, so that I can later manipulate those specific elements? Important to note the later part- I likely will not only want to manipulate the text when the button is pressed. I will also want to manipulate it later, at a time when the text may no longer be highlighted. This means I'll want to store SOMETHING to tell me what specific parts of the sentence I'm dealing with. If that solution isn't viable, is there a solution you can think of where, in the above "this is a cat" example, the user could select the second sentence, hit a button, and then later I know which sentence was selected when he hit that button?
According to the documentation, SelectionStart and SelectionLength can be both set and read. Just use those.
You dont even need to know the position of selected text to manipulate them, to edit the text that you have selected in the text you can simple set the SelectedText property to the new edited value.
// if textBox1.text = "Hello World World"; with first "World" selected
textBox1.SelectedText = textBox1.SelectedText.Replace("World", "Raj");
// then it becomes "Hello Raj World"

How to combine Database fields label together in crystal report

Hi
I am working in .Net crystal reports with asp2.0 and VS2010, now what i want is
i have four fields, drag and dropped, AddressName, AddressCity, AddressZip etc, now i have placed their labels and they repeat, what i want is, one label should have AddressName,AddressCity,AddressZip combined, like 507 Eden Towers Main Boulevard Gulberg, Lahore 54000. And also, i dont want separate fields to be combined as they overlap on lengthy record, i want one label with everything related to address binded.
Please help
You can just create a new formula field, and in that formula concatenate your fields together:
{YourTableName.AddressName} + " " + {YourTableName.AddressCity} + ", " + {YourTableName.AddressZip}
Then, instead of the AddressName, AddressCity and AddressZip fields, put your new formula field on the report instead.
You can also create a text label and drag any report field in the label. That way, the text is actually concatenated and you won't have any spacing problems.

How to format a date to be displayed in 2 lines?

I have a label called dateLabel that displays when did a user last time got logged in:
dateLabel.Text = "Sist gang logget inn: " + string.Format("{0:d}\n{0:T}", Session["LastLoginDate"].ToString());
What i want i to display the information in 2 different lines. In the first the date and in the one below the time.
How should i modify my code to achieve this?
Does it mind if i use a label, or maybe i should use another component?
Currently in that output there is a duplicate, but i don't understand why, how can i avoid that?
Current output:
Desired output:
Can someone give me some tips?
Replace \n with <br/>
Also replace
Session["LastLoginDate"].ToString()
with
(DateTime)Session["LastLoginDate"]
dateLabel.Text = string.Format("Sist gang logget inn:{1}{0:d}{1}{0:T}",
Session["LastLoginDate"],
"<br/>");
#sfrj as far as i know its not possible to wrap the text on asp:label control you can try a text box control instead read on the following link
http://geekswithblogs.net/StealThisCode/archive/2006/03/21/WrapLabels.aspx

Categories