473,246 Members | 1,533 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,246 software developers and data experts.

Creating and showing forms

I have been working on an application, which to this point has only involved
one Windows Form. I need to create another one; but on the Project menu,
there are two options: "Add Windows Form" and "Add Inherited Form."

I don't know which one to use. Also, once I choose one of those two options,
how can I show the second form when a user clicks a button in the first
form? Thanks in advance.
Nov 20 '05 #1
8 1299
"jy836" <mo***@nospam.com> schrieb
I have been working on an application, which to this point has only
involved one Windows Form. I need to create another one; but on the
Project menu, there are two options: "Add Windows Form" and "Add
Inherited Form."

I don't know which one to use. Also, once I choose one of those two
options, how can I show the second form when a user clicks a button
in the first form? Thanks in advance.

http://msdn.microsoft.com/library/en...mToProject.asp
http://msdn.microsoft.com/library/en...delessForm.asp

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

"jy836" <mo***@nospam.com> wrote in message
news:gVAUb.182181$Rc4.1344808@attbi_s54...
I have been working on an application, which to this point has only involved one Windows Form. I need to create another one; but on the Project menu,
there are two options: "Add Windows Form" and "Add Inherited Form."

I don't know which one to use. Also, once I choose one of those two options, how can I show the second form when a user clicks a button in the first
form? Thanks in advance.


Someone else gave you a reference for adding forms / showing them.

As for which option to choose, between "Add Windows Form" and "Add Inherited
Form", well, if I say that all windows forms are classes and the choice is
still not clear, I would highly suggest that you read up and make sure that
you fully understand inheritence and general .NET class fundamentals. I am
afraid that without a firm grasping of these concepts, pruducing effecient
code is nearly impossible.

Nov 20 '05 #3
Cor
Hi Jy,

In your situation, just add form

And to use it put in your form1 something as
dim frm as form2
frm.showdialog
frm.dispose

I hope this helps,

Cor
Nov 20 '05 #4

let your current form be form1 and the newly created form
be form2 which you add as a new form.
in the onclick event of your command button to show this
form add this code:
dim frx as new form2
frx.show
this will show the new form form2 once the button is
clicked !
-----Original Message-----
I have been working on an application, which to this point has only involvedone Windows Form. I need to create another one; but on the Project menu,there are two options: "Add Windows Form" and "Add Inherited Form."
I don't know which one to use. Also, once I choose one of those two options,how can I show the second form when a user clicks a button in the firstform? Thanks in advance.
.

Nov 20 '05 #5
"ziad dodin" <do****@cyberia.jo> wrote in message
news:ba****************************@phx.gbl...

let your current form be form1 and the newly created form
be form2 which you add as a new form.
in the onclick event of your command button to show this
form add this code:
dim frx as new form2
frx.show
this will show the new form form2 once the button is
clicked !
-----Original Message-----
I have been working on an application, which to this

point has only involved
one Windows Form. I need to create another one; but on

the Project menu,
there are two options: "Add Windows Form" and "Add

Inherited Form."

I don't know which one to use. Also, once I choose one of

those two options,
how can I show the second form when a user clicks a

button in the first
form? Thanks in advance.
.


Thanks for all of your responses. With your help, I've gotten the forms up
and running. I'm consistently having problems referencing controls on one
form from another form, though. Is there a simple way to do this? Thanks.
Nov 20 '05 #6
Hi,

Something definitely needs to be placed on the .Net box that explains this
:-) Lots of people are missing a basic point which seems to lead them down
the wrong path. Consider that a "form" that you create is a Class. If you
defined any other class with properties and methods you would expect
(normally) to instantiate one, you would refer to the properties using dot
notation, you'd recognize that you couldn't see any private members of the
class unless you had public accessors.

It isn't different for classes inheriting from System.Windows.Forms

Does this help?
"jy836" <mo***@nospam.com> wrote in message
news:OgRUb.184792$Rc4.1410842@attbi_s54...
"ziad dodin" <do****@cyberia.jo> wrote in message
news:ba****************************@phx.gbl...

let your current form be form1 and the newly created form
be form2 which you add as a new form.
in the onclick event of your command button to show this
form add this code:
dim frx as new form2
frx.show
this will show the new form form2 once the button is
clicked !
-----Original Message-----
I have been working on an application, which to this

point has only involved
one Windows Form. I need to create another one; but on

the Project menu,
there are two options: "Add Windows Form" and "Add

Inherited Form."

I don't know which one to use. Also, once I choose one of

those two options,
how can I show the second form when a user clicks a

button in the first
form? Thanks in advance.
.


Thanks for all of your responses. With your help, I've gotten the forms up
and running. I'm consistently having problems referencing controls on one
form from another form, though. Is there a simple way to do this? Thanks.

Nov 20 '05 #7
"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:OJ**************@TK2MSFTNGP11.phx.gbl...
Hi,

Something definitely needs to be placed on the .Net box that explains this
:-) Lots of people are missing a basic point which seems to lead them down the wrong path. Consider that a "form" that you create is a Class. If you defined any other class with properties and methods you would expect
(normally) to instantiate one, you would refer to the properties using dot
notation, you'd recognize that you couldn't see any private members of the
class unless you had public accessors.

It isn't different for classes inheriting from System.Windows.Forms

Does this help?


Thanks for your reply. Maybe I should explain what it is I'm trying to do.
:-) I have a form titled MainForm (the one that is automatically placed in
any VB Windows Application project, but I renamed it), and another new one
called PrefsForm (a form used for setting user preferences). I created the
new form (PrefsForm) by selecting "Add Windows Form" from the Project menu.

When I click on a menu in MainForm, this is the code that is executed:

Private Sub MenuItem8_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem8.Click
Dim Prefs As New PrefsForm
Prefs.ShowDialog()
End Sub

What I want to do is when the user types a path and filename of a database
into a text box on PrefsForm, the ConnectionString of OleDbConnection1
(which is on MainForm) will be changed accordingly. But I can't seem to find
a way to access the OleDbConnection1 control on MainForm from PrefsForm.
Hope this makes sense...thanks for your help!
Nov 20 '05 #8
"jy836" <mo***@nospam.com> wrote in message
news:RFSUb.185196$Rc4.1414107@attbi_s54...
Thanks for your reply. Maybe I should explain what it is I'm trying to do.


Generally speaking explanations usually do help :-) In this case the answer
is... "you don't want to do it that way." Problem solved :-)

Seriously if you "really wanted" to have your PrefsForm interact with
controls on your main form you could pass along a reference to the main
form... again consider what you would do if these weren't forms but were any
other object which you happened to be working with. This could be done in
the constructor of PrefsForm for instance. You could also set it up to just
the control along. But neither case is ideal.

Rather when your main form receives control again have it get the
information out of PrefsForm. After the ShowDialog you can add code that
access it. Note that you still have a reference at that time. The form
can't be seen but it exists.

As a third alternative you can create a single public class that
encapsulates all the user preference information and both your main form and
the PresForm can reference it. Doing it that way would mean you wouldn't
have to come up with some scheme to pass along all the current user
preferences if they select the PrefsForm again.

Tom


Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel Hill | last post by:
OK, I have very, VERY basic background knowledge of VB6 and have now upgraded to VB.NET and now I'm struggling to bring up the forms I want. What I am looking to do is to have a click a command...
6
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle."...
2
by: Ludovic SOEUR | last post by:
Have everyone tried to create controls in separated threads ? I have a problem that I do not understand. To simplify the explanations, I wrote theses few lines to show an example of the problem....
1
by: Henry | last post by:
I was trying to work through the Lab 2 exercises in the Microsoft's Windows-Based Applications in Visual C#. While I am not showing any errors I am also not seeing the mainMenu object when I run...
5
by: Randel Bjorkquist | last post by:
Hers's my question. I want the ability to set a property of an object I've created, from outside of the class code (ie... inside of "Main" or an application event), with an enum. Something like...
3
by: Asad | last post by:
Hi, I am trying to write my first Windows application using VB.NET and I am having some difficulties designing the UI. Basically its one Windows Form with 4 menus on the top (no drop downs)....
3
by: Torben Laursen | last post by:
I have a COM shared add-in written in C# that I use in Excel. One of the thinks that the user can do is to open some winforms. The problem that I have is that the first time the user opens a...
1
by: Miro | last post by:
VB 2005 Express. I can create a simple MDI app, with 2 forms. On Form1 I add a menustrip on top - and click on ( Insert Standard Items ) Add a ToolStrip as well and add 2 buttons. On Form2,...
6
by: Kappucino XL | last post by:
Hi there... I'm busy with a project where I view my information in forms. I get to choose the info I want using comboboxes. All info viewed, is in my tables, and also stored in a query. I have now,...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.