## Where should I put this block of codes? Please reconstruct it for me :(

I want my program to determine the empty textboxes and display the name of textboxes in a messagebox .Can you please reconstruct it for me :( Where should I put this block of codes ? FOR CLEARER REFERENCE Private Sub btnsave_Click(sender As Objec...
more »

2017-09-18 02:09 (1) Answers

## 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

## How to remove first line text from text-box?

What wrong with my code as below: Select Case chkSTC.Checked Case True txtCargoDescription.Text = Resources._Global.ContrSTC & vbNewLine & txtCargoDescription.Text Case False Dim b As String() = Split...
more »

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

## How to disable certain string inside text box?

What I done as code below show that all the data inside text-box was disable. Private Sub chkSTC_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkSTC.CheckedChanged Select Case chkSTC.Checked Case True ...
more »

2017-09-13 05:09 (3) Answers

## How to capture the cursor position in a textbox?

I have a TextChanged event on my Masked TextBox and I want that its method be called just when the cursor stay at the end. For example: 222.222.2/21 The event shall be called as soon as the user types "1". XAML <TextBox Name=...
more »

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

## PowerShell limit entries in text boxes to integer values only

A small program with Windows Forms in PowerShell shall contain a calculator. I decided to use TextBoxes as input method, however I can't convert the content of these textboxes to integers. How would I limit the entry in textboxes to integer-only or...
more »

2017-08-31 13:08 (0) Answers

## How to use mathjax in placeholder of textbox in asp.net?

I recently added MathJax to my webform, I'm able to do everything except figure out how to use MathJax as a placeholder inside a TextBox. example: <asp:TextBox ID="textbox1" placeholder="$x^2$"></asp:TextBox> My placeholder doesn't wa...
more »

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

## How to Bind a TextBox in DataGrid to a List in Wpf?

Am working on a new Wpf project and struggling with Binding a TextBox in DataGrid to a List of objects in Wpf. Can anyone help me to fix? This is my code (simplified version) to generate the Datagrid rows by binding my Orders object. User can chang...
more »

2017-08-18 04:08 (1) Answers

## Restrict TextBox input upto particular value without disturbing cursor position

I have a WPF application(MVVM) .I want to restrict user from entering more than specific value in a TextBox. Suppose that value is '100' , then user shouldn't be able to enter 101 etc. I have tried following code. XAML: <TextBox Text="{Binding S...
more »

2017-08-17 07:08 (4) Answers

## C# When is TextBox.Text.Length < TextBox.SelectionStart

While implementing a Behavior for a TextBox in WPF, I saw numerous examples, that use the PreviewTextInput event to handle new input. Some of the examples (e.g. techqa.info) have a condition implemented that I don't understand: if (textBox.Text.Leng...
more »

2017-08-03 08:08 (0) 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

## Constraint length of Text in TextBox by its encoded representation

I have a TextBox in WPF. I want to restrict the length of the text in the TextBox. There is an easy way to restrict the number of characters by the property MaxLength. In my use case I need to restrict the text not by the number of characters but by...
more »

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

## How to Disable Paste option for alphabets and Special Characters but Enabled for Numbers

I Used this code for restricting to type alphabets and characters. <script type="text/javascript"> function isNumber(evt) { evt = (evt) ? evt : window.event; var charCode = (evt.which) ? evt.which : evt.keyCode; i...
more »

2017-07-21 14:07 (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

## how fill combobox with all records of a person from database based on his name on textbox?

here is my code but its retrieve only last record not all SqlConnection history= new SqlConnection("Data Source=.;Initial Catalog=db3;Integrated Security=True"); history.Open(); SqlCommand histcmd= new SqlCommand...
more »

2017-07-12 09:07 (2) Answers

## Not to clear textbox on page reload or button click event

I have developed a website in C# asp.net which contains a Master Page. I have designed a top menu with Search bar(txtSearch) and a button(LinkButton). When I click on search button it redirects to the page where searched data is to be displayed but w...
more »

2017-06-27 07:06 (4) 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

## WPF TextBox disable break on special characters

I have a TextBox defined like this: <TextBox Text="{Binding License.LicenseKey}" HorizontalContentAlignment="Left" TextAlignment="Justify" Width="350" Height="100" Margin="10,0,0,0" TextWrapp...
more »

2017-06-13 19:06 (2) 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

## saving Textbox values for next time I run an application

I have a form with 30 text boxes which contain default setting I set in my code. the user has an option to change it , but I want to know how can I save the new values chosen by the user in one (or more) of those text boxes for next time I run the ap...
more »

2017-05-11 12:05 (4) 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

## how to get value from dynamically created textbox in asp.net

hi i'm Cannot get value dynamically created textbox and save into database. plz help his is code which I have created in this code text box are created but when I will input the value in the text and retrieve the value from dynamically created text b...
more »

2017-04-08 21:04 (1) Answers

## I am trying to scale the background image of a TextBox but it is cropped

I have a TextBox in which I want to add an image as background. The first try is this: <TextBox Text="{Binding Titulo}" Height="Auto" HorizontalAlignment="Stretch" Margin="5,5,5,5" Name="txtTitulo" VerticalAlignment="Stretch" TextAlignme...
more »

2017-04-06 18:04 (1) 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

## How to reset drop down list back to default when there is nothing in textbox?

I have a textbox #Email and I have two dropped down list menus that is #Carriers and #Phones. When the Email is entered I want to enable only Carriers drop box but not the Phones. When the Carriers is selected the Phones dropdownlist has to be enable...
more »

2017-03-15 16:03 (2) Answers

## How to handle Ctrl + Enter with TextBox when AcceptsReturn is true?

In my UWP application, I want my TextBox to be able to go to new line by pressing down the Enter key but I also need to trigger an action when Ctrl+Enter are pressed. The issue is, I can't seem to find a way to prevent the text to go to the next li...
more »

2017-03-14 07:03 (1) Answers

## How to not allow user to input numbers in textbox

I am trying to make a textbox that doesn't allow to input numbers I have tried some codes but doesn't work Here is what I have tried: <asp:RegularExpressionValidator runat="server" ID="txtSurnameValidation" ControlToValidate="txtSurname" ...
more »

2017-03-03 16:03 (2) Answers

## C# Saving data from label and loading it from textbox

I made an app for investment bank. My problem is that I need to save the transaction information as transaction number, so later if I write the transaction number into a textbox, the form with this only data will appear as a labels I would really a...
more »

2017-02-27 12:02 (1) Answers

## Hiding the text of a TextBox control without using a PasswordBox

I am using a TextBox control for the user input in my Windows Phone 8.1 app. How can I hide the characters as user gives input? I am not using a PasswordBox because the defined InputScope is "Number" which is not possible in a PasswordBox. While ...
more »

2017-02-20 14:02 (2) Answers

## Why does WPF textbox not support triple-click to select all text

is there a reason why a WPF textbox does not support triple-click behaviour like most modern UIs these days do? By "triple click", I mean: double clicking a line of text in a textbox selects a single word, while triple clicking selects the whole lin...
more »

2017-02-17 12:02 (2) Answers

## wpf- dynamically create and add new textbox and textblock to grid row when button clicked

I have a grid layout. there are three columns on each row. 1stcolumn contain a TextBox and 2rd and 3rd column contain TextBlock. I added a new button and what i want to do is that whenever user click on the button it generate a new row that contains...
more »

2017-02-08 02:02 (1) Answers

## Dynamically created TextBoxes in a Table lost Text value

I have a Table dynamically generated and inside of 2 columns there are TextBoxes. During the postback the Textboxes are always empty even if I fill them. The table is builted in this way: protected void ddlScalaTaglie_SelectedIndexChanged(object s...
more »

2017-01-29 15:01 (4) Answers

## 2 states roundable numeric text box with knockoutjs

I want to have an html numeric text box with 2 states, when focused, it has to show all decimal places, and when focus is lost, only show 2 decimals. I've almost achieved it. HTML: <input data-bind="attr: { 'data-numericvalue': valueToRound}" cl...
more »

2017-01-16 12:01 (1) Answers

## C# WPF - How to Bind TextBox Enter Key Press to a Method?

I have a TextBox with an 'OK' button below it. The 'OK' button runs the method in my RunPanel static class like this: RunPanel.RunOK();. I would like pressing enter in the TextBox to also execute the method RunPanel.RunOK(). How could I do this in ...
more »

2017-01-02 01:01 (3) Answers