Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have an Application build in WPF. It have a Textbox that will always accept only 10 digits and is always ready for Scanning ID Barcode Contains 10 Digits or Entering Number with Keyboard.
Now some Customers are entering just 2 digits and leaving system as it is. Let us say he write 12 in TextBox and left it. When new Customer is coming he is Scanning his Id without noticing that there is something already written in the TextBox. So New Number is coming like this 1224444444 and two numbers are missing that is 34.
How can I clear Textbox before Scanning or Before Writing?
some example code of exactly how you are attempting this would be useful.
A WPF textbox can be cleared by either calling the .Clear method, or simply by setting the "Text" property of the Textbox to string.empty.
With regards to most barcode scanners i've seen and used (usually KB emulation), you can usually set them up to get a prefix and suffix on the data so that you can detect scan input over keyboard input. You can then detect a scan and clear the textbox prior to entering the new information
react at the new scanevent from the barcodescanner and clear the textbox.text with string.empty
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
when I put a breakpoints on my textbox it shows textbox.length = "" even if there are characters in the textbox
There is no Length property present in TextBox Class.
Probably you mean to Check the Length on Textbox Text property which is of string type.
textbox.Text.Length
More info about the code would be nice. Is your Textbox really enabled? No transparent layer in front of it? You used the mySQL-Tag. Does that mean you use some kind of binding in textbox? Possibly you can't change the content of your textbox, because the database-binding / connection is read-only?
Is there really some textbox.length property?? Are you sure you are referring to the right property? Try this:
Convert.ToString(textBox1.TextLength)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a situation on my C programming here and just wondering whether my solution is the correct way:
I have a LED display with particle count sensor and will show 6 digit of seven segment numbers as the count value. The sensor will give voltage input value. The input is from 0V to 10V. So the range of 0V-10V need to be shown in the display as 000000 to 999999 count.
My solution is:
Display number = Input voltage * 99999.9
For example:
Display number = 10.000*99999.9=999999
Display number = 5.500*99999.9=549999
Display number = 2.300*99999.9=229999
Is this the correct solution? I notice that I will get a lot of 9 on the display value.
The most usable and user friendly solution is to ignore the fact that your most significant digit is capable of displaying up to 9 and simply multiply by 10000 unless you desperately need the maxim resolution in which case simply use a scale factor of 100000 and document that your range is 0-9.99999.
My reasoning is that it is better to either loose one digit in the accuracy across the whole range or clip just the maximum value than to have an error across the entire range.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have my log-in form and under that there's also the "Change Password" my teacher recommended me that if I write my old password in the old password textbox i'll see the characters, but if I leave that textbox and go to the new password textbox the characters should turn into "*".
How can I make that possible ?
Firstly, by convention there's no need to do this. The only reason that happens on mobile devices is that it's very easy to type wrong characters on tiny keyboards with large fingers. Getting a chance to quickly preview the last typed character is highly desirable. On a WinForms app I've never come across that usability. But, if you really want to do it, you'll need to create a custom control. The problem is that the PasswordChar property will mask all characters, not just all but the last one.
You could perhaps inherit from TextBox and add a property called TimedPasswordChar. Then subscribe to the ValueChanged event. In this handler, if TimedPasswordChar is not null or empty then start a Timer object with a 1000ms interval. In the Tick event handler, stop the timer on the first line the convert the last character to the TimedPasswordChar. Bear in mind though that you will need to add each character you switch to the TimedPasswordChar to a private member variable holding the actual password. I'd suggest using System.Security.SecureString given it's a password.
Just before you convert the last char to the TimedPasswordChar then add the entered value with .AppendChar(...).
One point that complicates it though is if the user edits the string. You need to monitor which string has been edited and then use .RemoveAt(...) on the secure string to keep it in sync.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'd like to display a repeating event on a date/time display in an app. This date time display can take the form of a calendar, but it could also just be a list of upcoming events.
What is the best way to handle tracking this event that can repeat?
For example: Should the event be stored once in the database and projected out / repeated several times in the display code? Should the event be stored several times and then just rendered?
I did something like this before and I based my schema off of SQL Servers sysschedules table.
http://technet.microsoft.com/en-us/library/ms178644.aspx
The schema linked above will allow you to store the schedule for a job (event). Then you can calculate what dates the event occurs on based off of the schedule. This may be a lengthy calculation, so I would try to cache that result somewhere.
I think it depends on type of event it is. Is it like Christmas where once it comes along and happens you really aren't interested in it until the next occurrence? Or is it a task like, "Make sure I call my mom every month", where if it happens and you missed it you wouldn't want it to go away?
One way I recently implemented the latter was to have a record that had next_occurrence (date), reoccurence_period (weekly, monthly, yearly, etc) columns. So that as the next occurence approched it would show up in the list. Once it passed the list item would have a recycle icon that once pressed would update the record to the next future occurence.
Again, i'm not sure if this applies to your situation, but it worked well for mine.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 14 years ago.
Improve this question
I have a Winform application built with C# and .Net 2.0. I have a textbox set with the MultiLine property.
The problem is when someone writes text with multiple lines (press few enters), presses the save button, and then closes and loads the form again, all the new lines disappear (the text is there at least).
For example, if the textbox had this in it:
Line1
Line3
It will look like this after I save and load:
Line1 Line3
Any idea why?
Update
The database is PostGres and when I use PGAdmin I can see all the line AND the "enters". So the persistence seem to have save all the line... the problem seem to be when I put back the string in the Textbox.
If I recall correctly, the textbox is really a string array.
I think you can do this:
textBox1.Lines = foo.Split(new String[] {"\n"},StringSplitOptions.RemoveEmptyEntries);
Edit again: If you want to keep the blank lines, the change to StringSplitOptions.None
In Windows forms all carriage returns are preserved in a multiline text box, so the problem likely lies in the way data is retrieved from your database. I've never used PostGres, but I'm guessing that the way you're retrieving the text from the db is replacing all whitespace with single spaces.