textbox

How to insert hyphen “-” after 2 digits automatically in TextBox?

血红的双手。 提交于 2020-07-22 21:36:02
问题 I have one TextBox for user to input number. When user input to the TextBox then the format should be like this 01-22-34-40-33 I want to insert "-" after 2 digits in the TextChanged event handler. I do something like this but no work: if(txtRandomThirdTypeSales.Text.Length == 2) { txtRandomThirdTypeSales.Text += "-"; } else if (txtRandomThirdTypeSales.Text.Length == 5) { txtRandomThirdTypeSales.Text += "-"; } else if (txtRandomThirdTypeSales.Text.Length == 8) { txtRandomThirdTypeSales.Text +=

How to insert hyphen “-” after 2 digits automatically in TextBox?

风格不统一 提交于 2020-07-22 21:35:03
问题 I have one TextBox for user to input number. When user input to the TextBox then the format should be like this 01-22-34-40-33 I want to insert "-" after 2 digits in the TextChanged event handler. I do something like this but no work: if(txtRandomThirdTypeSales.Text.Length == 2) { txtRandomThirdTypeSales.Text += "-"; } else if (txtRandomThirdTypeSales.Text.Length == 5) { txtRandomThirdTypeSales.Text += "-"; } else if (txtRandomThirdTypeSales.Text.Length == 8) { txtRandomThirdTypeSales.Text +=

creating a new line on a textbox in tkinter

廉价感情. 提交于 2020-07-20 21:05:51
问题 I have imported a list of names from a csv file and want to print each name a new line, how would i go about this as the program i have wrote prints it all on one line? import csv from tkinter import * master=Tk() file=open('Book1.csv') qwerty=csv.reader(file) people=[] for column in qwerty: people.append(column[0:7]) namelbl=Label(text='Name').grid(column=1,row=1) namebox=Text(master,width=10) namebox.grid(column=1,row=2) namesList = [x[0] for x in people] for names in sorted(namesList):

creating a new line on a textbox in tkinter

跟風遠走 提交于 2020-07-20 21:04:34
问题 I have imported a list of names from a csv file and want to print each name a new line, how would i go about this as the program i have wrote prints it all on one line? import csv from tkinter import * master=Tk() file=open('Book1.csv') qwerty=csv.reader(file) people=[] for column in qwerty: people.append(column[0:7]) namelbl=Label(text='Name').grid(column=1,row=1) namebox=Text(master,width=10) namebox.grid(column=1,row=2) namesList = [x[0] for x in people] for names in sorted(namesList):

creating a new line on a textbox in tkinter

旧巷老猫 提交于 2020-07-20 21:02:05
问题 I have imported a list of names from a csv file and want to print each name a new line, how would i go about this as the program i have wrote prints it all on one line? import csv from tkinter import * master=Tk() file=open('Book1.csv') qwerty=csv.reader(file) people=[] for column in qwerty: people.append(column[0:7]) namelbl=Label(text='Name').grid(column=1,row=1) namebox=Text(master,width=10) namebox.grid(column=1,row=2) namesList = [x[0] for x in people] for names in sorted(namesList):

Disable password TextBox Caps-Lock is On warning

蓝咒 提交于 2020-07-10 05:36:46
问题 I am creating a login thing and I have this problem that every time I click on this "Show Password" Button and the Caps-Lock is activated, a Warning pops up and won't leave (at least I think it won't, which for the end-user would be even worse) I would like to get rid of this warning completely. Before redirecting my question to this question: How to disable system's caps-lock notification on Textbox I have already tried that. Private Sub ShowPassword_MouseDown(sender As Object, e As

Change Particular line of Multiline textbox in C#

半腔热情 提交于 2020-06-16 04:55:09
问题 I am unable to Change the specific string of a multiline TextBox. suppose first line of multiline textbox is "Hello" & second line is "Bye" .But when i trying to change the value of second line like below. textBox1.Lines[1] = "Good bye"; When I saw the result using Debug mode it was not "Good bye". I also read this MSDN article & this stackoverflow question but can't get the desired answer. 回答1: As MSDN states (the link you provided): By default, the collection of lines is a read-only copy of

Email address input validation

Deadly 提交于 2020-06-12 06:04:42
问题 Is there any way to make a textbox input validation for email addresses in wpf C#? Regex or validation expression or anything that can help, best with code sample and some instructions 回答1: On the text_changed event you could pass the value of the textbox to a helper class. public static class ValidatorExtensions { public static bool IsValidEmailAddress(this string s) { Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"); return regex.IsMatch(s); } } Now on the text changed event you

Email address input validation

家住魔仙堡 提交于 2020-06-12 06:04:29
问题 Is there any way to make a textbox input validation for email addresses in wpf C#? Regex or validation expression or anything that can help, best with code sample and some instructions 回答1: On the text_changed event you could pass the value of the textbox to a helper class. public static class ValidatorExtensions { public static bool IsValidEmailAddress(this string s) { Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"); return regex.IsMatch(s); } } Now on the text changed event you

Three dots in textbox

北城余情 提交于 2020-05-15 08:20:48
问题 I have a textbox C# for IP addressing; validating IP address. However, I'm trying to limit to numbers and the amount of dots a user can enter in for the IP address. This way it limits errors. Seems I'm able to enter one dot, I would like to increase that number to three. I can create a "Regex.IsMatch" and validate using "IPAddress", but I'm just trying to limit what the user can enter before pressing a button to proceed. Is there a way to do this? Searching the Internet haven't found any way