B
B
Bwn_z2018-03-11 13:11:05
.NET
Bwn_z, 2018-03-11 13:11:05

C# Event Handling?

good afternoon. Maybe in a cap, the topic is a little blurry, but the essence is this. There is a code, 100 textboxes are created in Create, there is a dynamic button, I want to make an event "if the button is pressed, then process the values ​​in the textboxes", the processing goes on the click event, but I don’t understand how to work with these 100 textboxes now. For the test, I created str1, into which the values ​​of the textboxes will be written on the first line, i.e. [0,1],[0,2]....[0,9]. I made an output in one of the boxes just to see the result. As a result, {System.Windows.Forms.TextBox, Text: s System.Windows.Forms.TextBox, Text: System.Windows.Forms.TextBox, Text: sSystem.Windows.Forms.TextBox, Text: System. Windows.Forms.TextBox, Text: System.Windows.Forms.TextBox, Text: System.Windows.Forms.TextBox, Text: System.Windows.Forms.TextBox, Text: System.Windows.Forms. TextBox, Text: System.Windows.Forms.TextBox, Text:} Why does System?????? :
https://paste.ofcode.org/CrN6ki4XKiZXXiFWZsbSfQ

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2018-03-11
@mindtester

try to change here
ps line 78 of the source code.. but in general the approach itself.. is at least strange.. TexBox is a displayed control, but 100 textboxes is an outright nonsense... such a UI is not viable.. well, if visual controls are not needed - use strings .. or StrinBuilder, depending on the task
pps, all obj descendants have the ToString() method .. but it returns the object type .. not all obj descendants have a Text field, so developers, quite logically, do not override this method, without explicit need
ppps the most obvious reasons to override ToString() on types like Int32, Int64, Float, Double, value types in general.. but TextBox is (again) a visual control if you don't plan on forcing the user's attention by viewing 100 (or more? ) texts .. then, nevertheless, you will force the resources of the computer ))).. and the CPU and GPU, to display them, or at least readiness for display ... I think you should re-architecture your application
pppps if you use blanks of someone else's code, please note that TextBox.Text is: - firstly, a real text storage, secondly, it's a banal string... I hope this tip will help
ppppps be friends with MSDN .. good F1 button, in absolutely free VS studio 2017 Community helps a lot with this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question