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

Passing Values between Forms


hi

i have 2 forms (frm1,frm2) .. i launch frm2 by clicking a button on frm1. on frm2 there is another button. when i click on the button on frm2, i want the background color of frm1 to change yet i want to leave frm2 visible and not close it ..

NEED CODE PLEASE
THANX IN ADVANCE
Nov 20 '05 #1
3 1054
"=?Utf-8?B?V2lsbA==?=" <Wi**@discussions.microsoft.com> wrote in
news:22**********************************@microsof t.com:

hi

i have 2 forms (frm1,frm2) .. i launch frm2 by clicking a button on
frm1. on frm2 there is another button. when i click on the button
on frm2, i want the background color of frm1 to change yet i want
to leave frm2 visible and not close it ..

You'll need to pass a reference to frm1 in the constructor of frm2. Then
you can call a frm1 public method to change the color.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #2
"=?Utf-8?B?V2lsbA==?=" <Wi**@discussions.microsoft.com> wrote in
news:0D**********************************@microsof t.com:
makes sense .. but can you please show me some example, code ?


Class Form2
Private ref_frmForm1 as TypeofForm1

Public Sub New(ByRef Form1 as TypeOfForm1)
ref_frmForm1 = Form1
End Sub

Private Sub ChangeColorOnForm1()
ref_formForm1.PublicChangeColorFunction
End Sub
End Class
From Form1

Private Sub LaunchForm2()
Dim frmForm2 as Form2 = new Form2(Me)

frmForm2.show()
End Sub
Not sure if this is the best way, but it works.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #3
The best way that I found of doing this was to have a startup module, and
place this code within it:-

Module Startup
Public myMainForm As frmApplication
Sub Main()
myMainForm = NewfrmApplication
Windows.Forms.Application.Run(myMainForm)
End Sub
End Module
"Will" <Wi**@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...

hi

i have 2 forms (frm1,frm2) .. i launch frm2 by clicking a button on frm1. on frm2 there is another button. when i click on the button on frm2, i
want the background color of frm1 to change yet i want to leave frm2 visible
and not close it ..
NEED CODE PLEASE
THANX IN ADVANCE

Nov 20 '05 #4

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

Similar topics

4
by: rick | last post by:
Does anyone having a working example of passing values between web forms pages? I tried the example in the ms- help but I can't get by the following: To read property values from the source...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
0
by: Neelima Godugu | last post by:
Hi All, I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar with the security settings requirement inorder to do the above. I have...
2
by: Mani P.S via .NET 247 | last post by:
(Type your message here) Hi I'm new to asp.net and I need some help I have three forms with some textboxes.I want to pass the values of the textboxes of form1 and form2 to the third form For this...
1
by: Dave Harris | last post by:
I am a raw newbie to VB.NET trying to convert a data processing QuickBasic program into .NET. I have about 14 forms, the first of which has a bank of radio buttons identifying the airline. The...
2
by: o1j2m3 | last post by:
I created 2 forms, A and B using VB.NET 2003 in A, the codes are : ========================== public AsName as string public AsPrice as double public sub setValue(ByVal sname as string,...
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
3
by: Ross McLean | last post by:
Hi all, I've been teaching myself C# for a new project at work. I have a bit of a background in c++ and java but never been what you could call a guru. I'm having some strange things happening...
6
by: olsongt | last post by:
I have a C# problem I've been struggling with for a week now. I can't figure it out. I've made a sample application to demonstrate my problem: how do I pass data between forms? I've read tons of...
3
by: vidhyapriya | last post by:
Hi all I am developing windows application using vb.net.I want to pass values to open form.I am opening only one form when user click the buttons several times.Useing delegate i am passing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.