473,322 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

open a new Form

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
7 2774
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
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
* "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
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
* "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
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
* "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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Konstantin | last post by:
Can someone help me figure out a way to open a form only once in an MDI app. I have an MDI app that contains several forms. I use each form depending on the type of document that the user needs...
2
by: Julia Baresch | last post by:
Hi everyone, As some of you may know, we've been having trouble with an unrecognized database format error. Today I installed an unfinished project on the workstation of one of my users. ...
1
by: petersk | last post by:
Firstly I am an older person trying to teach myself to create a project and teach myself Access VBA programming along the way. I anticipate a number of problems I will need help with but here...
14
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
3
by: rdemyan via AccessMonster.com | last post by:
My application is split into a front end and back end. Each user has their own copy of the front end. There are a few forms I only want to be open for one user at a time. So I've implemented the...
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
10
waynetheengineer
by: waynetheengineer | last post by:
Hi, I'm trying to write code for a form when it closes. It's supposed to requery a combo box depending on which form is currenlty open in the background behind the current form, shown below: ...
19
by: =?Utf-8?B?R3JlZw==?= | last post by:
How can I tell via code if a Form is already open. Each time my forms load I have some initialization code that runs, but if the form is already open and hidden I don't want that initialization...
5
by: billa856 | last post by:
Hi, My project is in MS Access 2002. In that I want to open one form multiple times. I put one button on my main form. Now whenever I click on that button than form will be open. Now when I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.