By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,682 Members | 1,407 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,682 IT Pros & Developers. It's quick & easy.

open a new Form

P: n/a
Hi all,
i want to open a new Form in my VB.NET Application. How can i do this when i
want to add a paramter?

i know the code:

frmxxx.showdialog() or frmxxx.show

but how can i add paramter for this new form?

thx for help
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi Stephan,

Add a constructor to your Form which takes a parameter.

Class MyForm
Private TheParameter As Something
Public Sub New (ThisValue As Something)
TheParameter = ThisValue
End Sub
: : :
End Class

Then pass in the value when you create the Form - and when Show is called,
it will be available.

Dim frmxxx As MyForm
: : :
frmxxx = New MyForm (WhateverValue)
frmxxx.Show
Or
Dim frmxxx As New MyForm (WhateverValue)
frmxxx.Show

Regards,
Fergus
Nov 20 '05 #2

P: n/a
Hi Fergus,

thx for helping. It works.
Greetz
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:e3*************@tk2msftngp13.phx.gbl...
Hi Stephan,

Add a constructor to your Form which takes a parameter.

Class MyForm
Private TheParameter As Something
Public Sub New (ThisValue As Something)
TheParameter = ThisValue
End Sub
: : :
End Class

Then pass in the value when you create the Form - and when Show is called, it will be available.

Dim frmxxx As MyForm
: : :
frmxxx = New MyForm (WhateverValue)
frmxxx.Show
Or
Dim frmxxx As New MyForm (WhateverValue)
frmxxx.Show

Regards,
Fergus

Nov 20 '05 #3

P: n/a
* "Stephan Unger" <as**@asdf.ch> scripsit:
i want to open a new Form in my VB.NET Application. How can i do this when i
want to add a paramter?

i know the code:

frmxxx.showdialog() or frmxxx.show

but how can i add paramter for this new form?


\\\
Public Class ...
Inherits ...

Private m_UserName As String

Public Property UserName() As String
Get
Return m_UserName
End Get
Set(ByVal Value As String)
m_UserName = Value
End Set
End Property

' Change Me.UserName here.
End Class
///

Usage:

\\\
Dim f As New Form1()
f.UserName = "Max Mustermann"
f.ShowDialog()
MsgBox(f.UserName)
///

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

P: n/a
Hi Herfried,

LOL. I can't believe that you didn't notice that the query was answered
<and> the guy had said thanks and gone his merry way - 9 hours ago!!

Who are you talking to? ;-))

Regards,
Fergus
Nov 20 '05 #5

P: n/a
* "Fergus Cooney" <fi******@tesco.net> scripsit:
LOL. I can't believe that you didn't notice that the query was answered
<and> the guy had said thanks and gone his merry way - 9 hours ago!!

Who are you talking to? ;-))


Sorry, for some unknown reason I cannot see the other replies...

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

P: n/a
Hi Herfried,

That doesn't sound like good gnus. You've been ham(ster)strung by the
sound of it!

Regards,
Fergus

** Loud groans encouraged - permission to hit me granted ;-)
Nov 20 '05 #7

P: n/a
* "Fergus Cooney" <fi******@tesco.net> scripsit:
That doesn't sound like good gnus. You've been ham(ster)strung by the
sound of it!


I have changed some options in the newsreader and the posts are visible
now...

;-)

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.