Hack Forums
[.NET] How to pass value from form2 to form3 in vb.net - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] How to pass value from form2 to form3 in vb.net (/showthread.php?tid=5579925)



How to pass value from form2 to form3 in vb.net - adenfr - Mar 20, 2017

hello there im making a programme that generate sqlserver code to use it in my vb.net progarrme

i have first form conatain the connection like you see in picture below
[Image: 0OrPt]
the connection is works 100%
but in second form i have 2 datagridview
1- for tables
2- for fields

so when i click in any table of data gridview1 => datagridview2 show it fields

but when i clike on datagridview1 to get the value of combobox form form1 to use it in form2 i have error

https://imgur.com/a/TYjMq

Failed to connect to server.

my script
Dim frm As New Form2
prd.ServerConnection = New ServerConnection(frm.ComboServer.Text) ' here the error
prd.DGVField(MetroGridTables, MetroGridField)

so i use form1 to making connection and form2 to make operation but i have
Failed in connection to server.


* - Villxin - Mar 20, 2017

(Mar 20, 2017 07:56 AM)Visual Freedom Wrote:  You can use a module for shared objects.

^^This is the best way to do it.

I believe you can also do it by passing it through a public method, but I would recommend you avoid doing that.


* - adenfr - Mar 20, 2017

how that !!!! can you explain


* - Ninja - Mar 20, 2017

Pass the the values as parameters in the constructor of the other form. If that doesn't fit your needs then use a shared module or even the Settings class (or whatever its called).