Click here to Skip to main content
15,887,376 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I Have 100 Textbox or more in form
when I Fill Data finish in any textbox the data form textbox to show 1 label

What I have tried:

my Problem is I don't want to coding textchange event for each textbox

I am sorry about my Grammar T_T
Posted
Updated 4-Jul-23 18:06pm
v3
Comments
Graeme_Grant 4-Jul-23 12:45pm    
Why so many textboxes? That is highly inefficient!
Dave Kreskowiak 4-Jul-23 13:09pm    
100 TextBoxes on a form and you expect a user to be able to navigate them all? That's really unusable and very poor design. You seriously need to rethink your UI design and organize these entry fields better.

1 solution

As the others have said, that many textboxes on a single form is a pretty poor UI design: it's difficult to manage, difficult to code for, and difficult for a user to process.

It also probably looks very ugly! :D

If you need to present or request significant data to / from a user, then a better approach is to either use TabPages to break it up into groups of related items (as Visual Studio does with the "Project Properties" options when you double click on the "Properties" branch in the Solution Explorer) or to use a table based control like a DataGridView if the data is row / column based.
By throwing textboxes at the problem you are making a rod for your own back!

But ... having said that, you don't generally have to code a TextChanged event for each textbox - the same handler code can be associated with multiple controls as each time it is called it is passed two parameters: the EventArgs e and the object sender. The first describes the event and provides addition info about it in many cases; the latter is the Control instance that raised the event and you can cast that to a TextBox:
VB
Private Sub myComboBox_TextChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim tb As TextBox = TryCast(sender, TextBox)
    If tb IsNot Nothing Then
        Console.WriteLine($"Text Changed: {tb.Text}")
    End If
End Sub
 
Share this answer
 
Comments
Sravudh Daengmak 28-Jul-23 1:30am    
My process is..
...I Key my data into datagridview cell, and in the meantime show my data on label
immediately
OriginalGriff 28-Jul-23 1:47am    
And?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900