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

Refer to control on another form

Hello All:

I have recently upgraded to VB .Net 2003 from VB6 and am
having a little trouble.

I have a MDI parent form that has a frame on it with a
list box on the frame. I open an MDI child form and the
frame on the parent form is still visible. What I want to
do is run an OLEDBCommand on the child form and use the
value of the item selected in the list on the parent form
as a parameter when the user clicks a button. I tried the
following but it doesn't work.

Sub On_Click
Dim frm as Form1 'this is the parent form
Dim ListValue as Integer

ListValue=frm.listbox1.SelectedValue("ID")
Nov 20 '05 #1
1 3864

"Jeff" <je***************@utulsa.edu> wrote in message
news:0b****************************@phx.gbl...
Hello All:

I have recently upgraded to VB .Net 2003 from VB6 and am
having a little trouble.

I have a MDI parent form that has a frame on it with a
list box on the frame. I open an MDI child form and the
frame on the parent form is still visible. What I want to
do is run an OLEDBCommand on the child form and use the
value of the item selected in the list on the parent form
as a parameter when the user clicks a button. I tried the
following but it doesn't work.

Sub On_Click
Dim frm as Form1 'this is the parent form
Dim ListValue as Integer

frm = ctype(me.mdiParent, form1)

ListValue=frm.listbox1.SelectedValue("ID")
.
.
.
End Sub

I don't remember the exact syntax, if it's SelectedValue
("ID") or SelectedText("ID"). But even with the correct
syntax this doesn't work.

I can do this using a public variable (set the variable in
the parent form when the user selects an item in the list
and set the ListValue variable in the child form equal to
the public variable, but this could get ugly.

So my question is how can I reference a control on another
form to retrieve it's value?

Any help is greatly appreciated.

Jeff

Nov 20 '05 #2

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

Similar topics

6
by: octagon | last post by:
Hi, I have a form with various types of control such as txtbox, combo box, listbox, subform and check box I am trying hard to write a code for a check box after check the box all the control in...
4
by: solar | last post by:
How to refer to a subform ? On my main form called FrmEmployees I have a button to open a report. I want to forbid opening the report in case the liters in the subform are 0. To this end I...
3
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form showing customer data, there is a tab control. One...
1
by: MP | last post by:
I have a main form that has a subform which also has a subform: the main form is the first subform is the second subform is When I click on the button »AddNewSubSubRecord« (add a new record...
6
by: Jess | last post by:
hi, I am doing a windows application. I have this basic problem: I have a class Form1 got a label from another class B i want to display some text in the label in form 1 in class B, the...
1
by: Paul | last post by:
I have a MDI container form "frmParent". On that form there is a tabstrip control with 2 pages. On one of those pages there is a textbox and a button. When the user clicks on the button a...
1
by: jz | last post by:
Hi All, I have an ActiveX control project, in the main form, I have an image control and load a JPG image from by setting Picture property of Image; I build it and everything is good, I...
4
by: Lysander | last post by:
I need a way of finding the name of the active control on a form. You can use currentdb() to refer to the current database You can use Me to refer to the active form or report. I need a...
5
by: ChipR | last post by:
Question: Can I set a form's variable from another form? Details of my problem: In my Form1, I have Option Compare Database Option Explicit 'whether each tab has been updated, so they...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.