Convert text to integer to compare in C#

The C# program receives a string labeled: 1.2345 V I need to compare this value using < or > in a 'if' statement. How do I convert the string above to a integer? I tried to use: int anInteger; anInteger = Convert.ToInt32(textBox1.Text); anInt...
more »

2017-09-15 15:09 (3) Answers

WPF TextBox no Space allowed

I want a user to only write numbers (0-9) in a TextBox. I'm using following code to prevent the user of writing letters and other characters except of numbers, but I can't avoid the user to use the space in the TextBox. private void CheckIsNumeric(T...
more »

2017-08-02 11:08 (2) Answers

Regex to allow a user to type in a time - C#

Lots of other questions give answers for regex expressions which only allow fully completed times like this: ^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$ But this is no use in a Textbox.TextChanged event because while typing 15:45 the textbox will cont...
more »

2017-07-19 22:07 (1) Answers

WPF control extra pixels source

I have these simple wpf controls in this layout. My question where is the extra pixels coming from in the TextBox. It looks like the TextBox is not respecting the Width='Auto' property. I'm looking to make the Grid Column 0 width equal exactly to th...
more »

2017-06-14 16:06 (1) Answers

Make WPF TextBox Margins Clickable/Selectable

I have a WPF TextBox with a white background. I've given it some Padding so that the text has a "margin" around it (akin to the margins in, say, MS Word). <TextBox x:Name="MyTextBox" Padding="25" /> Unlike in Word, however, this blank area a...
more »

2017-05-28 22:05 (0) Answers

C# Right to Left in TextBox

I try to do TextBox moving, for Rss updates, but the problem is that the Rss text is also in Hebrew in English and also numbers, so every time it reaches the number it starts to go crazy :) Exmaple Rss = " * ynet - מבזקים * Ynet * ביקו
more »

2017-05-22 09:05 (1) Answers

Press an "@" and drop-down a ComboBox. [C#]

First of all sorry if this is repeated, but I didn't find anything yet about that. Is it possible in C# to press a specific key on a TextBox, in this case "@", and dropdown a list of names? It's the same thing that FB and Whatsapp does now. In order...
more »

2017-05-09 09:05 (0) Answers

search in DataGrid by textBox WPF

I have grid with 10-15 columns. (I load data by datagrid.ItemsSource = myList.ToList()) Also I have textBox witch textChanged event. When I put here eg. "cat" I want to see only rows with value ...cat... how do I make this? ...
more »

2017-03-15 23:03 (1) Answers