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

Really Dumb Questions about forms

I thought that I was a reasonable programmer but I am having some very
basic problems with .net

1) In vb3 to vb6 to use another form I said
frmColorTool.Show

What is the correct syntax in vb.net

2) how do I adress the controls in another form

Again I used to say
Form1!control.text

How do I do this now?

--
Remove norubbish to reply direct

Jack Russell
Nov 21 '05 #1
3 961
Jack,

In VB.NET, forms and controls are objects just like regular objects. So,
you'll need to instantiate the form before you can call Show on the form.
Similarly, you'll need an instance of the form to access the controls of
that form.

Dim frm As New frmColorTool
frm.Show() ' Or frm.ShowDialog() for modal

Debug.Write(frm.txtTextBox.Text)

Note that in VB.NET, since the default access modifier for controls is
Friend, you can access the controls of a form from another form only if both
forms are in the same project.

hope that helps..
Imran.

"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
I thought that I was a reasonable programmer but I am having some very
basic problems with .net

1) In vb3 to vb6 to use another form I said
frmColorTool.Show

What is the correct syntax in vb.net

2) how do I adress the controls in another form

Again I used to say
Form1!control.text

How do I do this now?

--
Remove norubbish to reply direct

Jack Russell

Nov 21 '05 #2
Thanks, that is the way that I am doing it, I just find it hard to
believe that MS seems to have gone backwards!

Imran Koradia wrote:
Jack,

In VB.NET, forms and controls are objects just like regular objects. So,
you'll need to instantiate the form before you can call Show on the form.
Similarly, you'll need an instance of the form to access the controls of
that form.

Dim frm As New frmColorTool
frm.Show() ' Or frm.ShowDialog() for modal

Debug.Write(frm.txtTextBox.Text)

Note that in VB.NET, since the default access modifier for controls is
Friend, you can access the controls of a form from another form only if both
forms are in the same project.

hope that helps..
Imran.

"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
I thought that I was a reasonable programmer but I am having some very
basic problems with .net

1) In vb3 to vb6 to use another form I said
frmColorTool.Show

What is the correct syntax in vb.net

2) how do I adress the controls in another form

Again I used to say
Form1!control.text

How do I do this now?

--
Remove norubbish to reply direct

Jack Russell


--
Remove norubbish to reply direct

Jack Russell
Nov 21 '05 #3
Not backwards, just more accurate.

Older versions of VB held global references to your forms behind the scenes
for you so all you had to do was frmForm.Show or frmForm.Load.

VB.NET requires you to actually create instances of your forms because,
after all, they are really just classes that inherit from type
System.Windows.Forms.Form.

"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
Thanks, that is the way that I am doing it, I just find it hard to
believe that MS seems to have gone backwards!

Imran Koradia wrote:
Jack,

In VB.NET, forms and controls are objects just like regular objects. So,
you'll need to instantiate the form before you can call Show on the form. Similarly, you'll need an instance of the form to access the controls of
that form.

Dim frm As New frmColorTool
frm.Show() ' Or frm.ShowDialog() for modal

Debug.Write(frm.txtTextBox.Text)

Note that in VB.NET, since the default access modifier for controls is
Friend, you can access the controls of a form from another form only if both forms are in the same project.

hope that helps..
Imran.

"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
I thought that I was a reasonable programmer but I am having some very
basic problems with .net

1) In vb3 to vb6 to use another form I said
frmColorTool.Show

What is the correct syntax in vb.net

2) how do I adress the controls in another form

Again I used to say
Form1!control.text

How do I do this now?

--
Remove norubbish to reply direct

Jack Russell


--
Remove norubbish to reply direct

Jack Russell

Nov 21 '05 #4

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

Similar topics

0
by: ted holden | last post by:
Dumb questions: Suppose you have an application which shows text and a corresponding mpeg video file. The user does a search and clicks one of the hits, the text around the hit shows up in one...
9
by: Coleen | last post by:
I'm using MS .Net Version 7, using VB .Net working on a "simple" web page. All I want to do is display a messagebox. I tried using Messagebox.Show, and get an error that Messagebox has not been...
2
by: Caladin | last post by:
I'm sure once someone answers this I'll feel really dumb. I'm a c++ programmer playing with c# an here's my conundrum I declare a class in the for public class Form1 :...
2
by: Arghknork | last post by:
I'm sure I'm going to feel stupid when someone answers this, but what am I doing wrong? I have a simple form that loads a text file and displays it in a listbox with a progress bar based on the...
14
by: Bill Nguyen | last post by:
what's the equivalent syntax for app.path in VB.NET? Thanks Bill
2
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new...
16
by: CMM | last post by:
Is it me or has anyone noticed that F1 is really dumb in VS2005. Since VB3 I have been able to click F1 on an ambiguous method in code and the IDE automatically determines the type based on the...
1
by: robertmeyer1 | last post by:
Hi, I have 3 tables set up. tblQuestion, tblAnswer, tblClient. I have them linked together and have a sbf and mainform set up for data entry. The sbf links the questions and answers together. ...
8
by: =?Utf-8?B?TFc=?= | last post by:
Hello! I am just learning about forms authentication so please excuse this basic question. I am using .NET 1.1 and C#. I have created my web.config file and my login.aspx and the associated cs...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.