473,779 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sh ow

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.t ext

How do I do this now?

--
Remove norubbish to reply direct

Jack Russell
Nov 21 '05 #1
3 972
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.Tex t)

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***@norubbis h.tpg.com.au> wrote in message
news:ut******** ******@TK2MSFTN GP09.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.Sh ow

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.t ext

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.Tex t)

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***@norubbis h.tpg.com.au> wrote in message
news:ut******** ******@TK2MSFTN GP09.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***@norubbis h.tpg.com.au> wrote in message
news:ed******** ******@TK2MSFTN GP09.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.Tex t)

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***@norubbis h.tpg.com.au> wrote in message
news:ut******** ******@TK2MSFTN GP09.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
1337
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 window and the video synchs to the text in another. The user can then click a play button and the text will scroll with the video, with the line being spoken highlighted at all times. The question becomes what if a user wanted a network version...
9
1751
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 declared. I tried using MsgBox (like we used in VB 6) but this throws application errors every time I run it I get the error "It is in valid to show a modal or form when the application is not running in UserInteractive mode. Specify the...
2
1213
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 : System.Windows.Forms.For class Class
2
1011
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 byte size of the file. Once the display begins, I can't move the form - it just hangs up while it's filling. Also, if I bring another window into focus, the scrolling display stops and doesn't come back even if I bring my form back into focus. ...
14
1392
by: Bill Nguyen | last post by:
what's the equivalent syntax for app.path in VB.NET? Thanks Bill
2
2227
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 folder using whatever project name I supplied. Is there a work around for this? Thanks Bill
16
1652
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 code itself and shows the right help topic. This even worked more or less in VS2003. But in VS2005, if I highlight the "Host" method below and hit F1 I get a help topic on the "UriBuilder.Host" property. Huh????? That's dumb. Dim o as New...
1
1480
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. The mainform is based off the tblClients and has the sbf inserted into it. At this point, all the questions from tblQuestions are shown, and tblAnswers have $0.00 (currency fill-in field). SO the questions are all prepopulated with the default...
8
2153
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 file using examples on MSDN. I have created a FormsAuthenticationTicket and cookie and added the cookie to the response and then set the SetAuthCookie etc. When I go to the redirected page, I am not sure how to read the cookie value so I know who...
0
9633
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10305
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10137
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9928
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8959
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.