Copying one TextBox to another TextBox

Pop85 Posted messages 17 Status Membre -  
 Anonymous user -

Hello everyone,

Here's my little problem in a form under Visual Basic: I have a TextBox with information obtained from a calculation, and I would like to retrieve this information in another TextBox of another form (same project). I've written my procedure in a button_click like this:

Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TBArbre.Text = Chemin_de_vie.TBRésArbCelt.Text
End Sub

Thank you for your advice.

Pop85

2 réponses

Anonymous user
 

Good evening


To post code, please use syntax highlighting, as described here https://codes-sources.commentcamarche.net/faq/11288-poster-un-extrait-de-code


It is not recommended to use accents or any other diacritical marks in variable names, components, methods, classes, etc...


Similarly, it is not advisable to make a form element public, and for what you wrote to work, the textbox must be public.


Here is a tutorial that brings together different ways to interact between two forms https://codes-sources.commentcamarche.net/faq/11107-interactions-entre-form-en-net-c-et-vb-net


Note that forms are classes like any other (except that they have a graphical interface) and thus these interactions between classes are also possible.


When I was little, the Dead Sea was just sick.
George Burns

-1
Anonymous user
 

By the way, regarding the coloring and the highlights, I already told you on August 29.

If you come seeking advice and don’t apply it, it’s not very useful...


When I was little, the Dead Sea was just sick.
George Burns

-1