简体   繁体   中英

how to apply changes to datagridview without database vb

Dim form As New form2
saleform.DataGridView3.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox4.Text, TextBox5.Text)

PS the code came from another form. The code works when it is on the same form as DataGridView, but doesn't work when used from the second form.

On the form with the textboxes, declare a variable for each textbox, and set the variable to hold the textbox value.

  • Eg; var1 = textbox1.Text
  • var2 = textbox2.Text

Then, pass the variables in as parameters when loading the form. On the second form, declare a variable for each, and set the variables to be the same as the ones you passed in (But with different names, obviously). Then, use these variables in the add row code. (The variables need to be in the New sub of the second form)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM