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

inter-form communication

VB.Net >>
Can someone give me some insights as to communicating info between
2 forms. Generically, I have the following - 1 form with a datagrid which is
the result of a search operation. Another form that holds detailed data for
each row in the search result grid.

I would like the ability to double-click on a row in the searchresult form
and have all the data populate in the main form. I have written all the code
to do the population on the main form, I just need a way to 'fire' the event
in the main form from the search grid form. Any suggestions / links, etc.
Thanks in advance
Nov 21 '05 #1
4 1465
The method I use to do this is to pass a reference of one form to the other.
public class Form2
dim OtherForm as Form
sub new(byref Value as Form) 'Send in Form1
otherform = Value
end sub
end class

Then create some properties in Form1 to return the information you need in
form2.

'Very crude way of doing it
Public Class From1
public readonly property DG() as datagrid
.... Return DataGrid
end property
end Class

No code was ran in the IDE, all typed here so beware....
Hope it sparks some ideas.
Chris
"MSSQLServerDeveloper" <MS******************@discussions.microsoft.com>
wrote in message news:A0**********************************@microsof t.com...
VB.Net >>
Can someone give me some insights as to communicating info between
2 forms. Generically, I have the following - 1 form with a datagrid which
is
the result of a search operation. Another form that holds detailed data
for
each row in the search result grid.

I would like the ability to double-click on a row in the searchresult form
and have all the data populate in the main form. I have written all the
code
to do the population on the main form, I just need a way to 'fire' the
event
in the main form from the search grid form. Any suggestions / links, etc.
Thanks in advance

Nov 21 '05 #2
The method I use to do this is to pass a reference of one form to the other.
public class Form2
dim OtherForm as Form
sub new(byref Value as Form) 'Send in Form1
otherform = Value
end sub
end class

Then create some properties in Form1 to return the information you need in
form2.

'Very crude way of doing it
Public Class From1
public readonly property DG() as datagrid
.... Return DataGrid
end property
end Class

No code was ran in the IDE, all typed here so beware....
Hope it sparks some ideas.
Chris
"MSSQLServerDeveloper" <MS******************@discussions.microsoft.com>
wrote in message news:A0**********************************@microsof t.com...
VB.Net >>
Can someone give me some insights as to communicating info between
2 forms. Generically, I have the following - 1 form with a datagrid which
is
the result of a search operation. Another form that holds detailed data
for
each row in the search result grid.

I would like the ability to double-click on a row in the searchresult form
and have all the data populate in the main form. I have written all the
code
to do the population on the main form, I just need a way to 'fire' the
event
in the main form from the search grid form. Any suggestions / links, etc.
Thanks in advance

Nov 21 '05 #3
Would it be true to say that the main form creates the form with the grid?
If so, it has a handle/reference to the sub-form. I would have an event in
the sub-form that is fired when the user double-clicks, and create a class
derived from EventArgs to pass the data to display.

Before the main form displays the sub-form, add a handler to sink the
sub-form event. Then, when the event fires, the main form can do the
populating thing.

HTH

Charles
"MSSQLServerDeveloper" <MS******************@discussions.microsoft.com>
wrote in message news:A0**********************************@microsof t.com...
VB.Net >>
Can someone give me some insights as to communicating info between
2 forms. Generically, I have the following - 1 form with a datagrid which
is
the result of a search operation. Another form that holds detailed data
for
each row in the search result grid.

I would like the ability to double-click on a row in the searchresult form
and have all the data populate in the main form. I have written all the
code
to do the population on the main form, I just need a way to 'fire' the
event
in the main form from the search grid form. Any suggestions / links, etc.
Thanks in advance

Nov 21 '05 #4
Would it be true to say that the main form creates the form with the grid?
If so, it has a handle/reference to the sub-form. I would have an event in
the sub-form that is fired when the user double-clicks, and create a class
derived from EventArgs to pass the data to display.

Before the main form displays the sub-form, add a handler to sink the
sub-form event. Then, when the event fires, the main form can do the
populating thing.

HTH

Charles
"MSSQLServerDeveloper" <MS******************@discussions.microsoft.com>
wrote in message news:A0**********************************@microsof t.com...
VB.Net >>
Can someone give me some insights as to communicating info between
2 forms. Generically, I have the following - 1 form with a datagrid which
is
the result of a search operation. Another form that holds detailed data
for
each row in the search result grid.

I would like the ability to double-click on a row in the searchresult form
and have all the data populate in the main form. I have written all the
code
to do the population on the main form, I just need a way to 'fire' the
event
in the main form from the search grid form. Any suggestions / links, etc.
Thanks in advance

Nov 21 '05 #5

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

Similar topics

1
by: David M. Karr | last post by:
I've been asked to help debug a complex problem involving inter-frame references, so I just want to understand the elements involved with this. Apparently, there is a page with multiple frames,...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
6
by: les | last post by:
Here's a class which uses 2.0 generics to implement an inter-thread message queue in C#. Any number of threads can post and read from the queue simultaneously, and the message object can be any...
7
by: Sumedh | last post by:
Hi everyone There is a C# project which calls C++/CLI dll to be able to call native C++ including templates. But the C++/CLI code itself also requires the C# dll to get the types. For example: ...
1
by: Laurence | last post by:
Hi folks, As I konw: database partition (aka data partition?), the database can span multiple machines; table partition, the data within a table can seperate by certain condition. How about...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.