473,695 Members | 2,258 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Double click on data grid to open another form

I have a vb.net datagrid bound to a dataview on a windows form. I want to
use the datagrid to display and filter a list of items, but since the data
is complex, I don't want the user to edit the item using the datagrid. I'd
like to have another form display when the user double clicks the desired
row in the datagrid, and have that form display details for the selected
datagrid row.

I'm having problems figuring out the best way to pass the selected row on
the first form to the second form. All of the data (including data from
related tables,) is already populated in the underlying dataset on the first
form, so I'd like to pass the dataset also. Can anyone recommend the best
and/or easiest way to accomplish this?

Thanks!
Nov 20 '05 #1
3 11903
Cor
Hi Young,

The most easy way I is to make a module and put the variables in that.
(Those are everywhere usable, in you whole project).

I don't do it I would make a class with shared properties
Witt that I can better see what I am doing.

Rough typed and just as an example
\\\
Public Class datagridinfo
private shared mA as string
private shared mB as string
Public shared property A as string
Get
return mA
End Get
Set (byval value as string)
mA = value
End set
Public Shared property B as String
.... same as A
end Class

Now you can say in form1
datagridinfo.A = mylineInFormA

And in form1
mylineInFormB = datagridinfo.A
////

I hope this helps a little bit

Cor


Nov 20 '05 #2
Cor
Mayby confusing the last part therefore this to correct
">
Now you can say in form1
datagridinfo.A = myItemInForm1

And in form2
myItemInForm2 = datagridinfo.A
Cor
Nov 20 '05 #3
Hello Young
Here is some code that does exactly that:

Private Sub DataGrid1_Doubl eClick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles DataGrid1.Doubl eClick

Dim MyGrid As DataGrid = DirectCast(send er, DataGrid)

Dim MyEdit As New UpdateAccountTy pes(MyDataSet,
MyGrid.CurrentC ell.RowNumber)

MyEdit.ShowDial og()

Me.DataGrid1.Re fresh()

End Sub
This passes a dataset, and a row number based on the grid's
CurrentCellRowN umber

The Edit form's constructer (Sub New()) takes these two values as an
argument. Just write the code inthe form to handle your editing chores. Any
edit changes you make in the edit form will be reflected in the grid itself.
To make the changes persist, you'll have to update using the dataadapter for
that dataset.

Ibrahim
"Young J. Putt" <j.****@verizon .net> wrote in message
news:0L******** *******@nwrdny0 3.gnilink.net.. .
I have a vb.net datagrid bound to a dataview on a windows form. I want to
use the datagrid to display and filter a list of items, but since the data
is complex, I don't want the user to edit the item using the datagrid. I'd like to have another form display when the user double clicks the desired
row in the datagrid, and have that form display details for the selected
datagrid row.

I'm having problems figuring out the best way to pass the selected row on
the first form to the second form. All of the data (including data from
related tables,) is already populated in the underlying dataset on the first form, so I'd like to pass the dataset also. Can anyone recommend the best
and/or easiest way to accomplish this?

Thanks!

Nov 20 '05 #4

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

Similar topics

1
4426
by: Dalan | last post by:
I probably just need a simple piece of code to do this as the couple tried so far have failed. I created a new Access 97 Form Filter (frmFilterForm) which displays most of the key data fields from the main form (frmMain) records. What I'm trying to do is simply double click on an autonumber ID column record in frmFilterForm and have it to open the related record in frmMain for updates. Any assistance will be appreciated. Thanks.
3
1977
by: Pete | last post by:
I'm currently doing a database that uses comboboxes to look up records in other tables, whether they be lookup tables or otherwise. When a user needs to add an item to one of these tables, the user has to either double-click on the combobox or go to the appropriate form via an item on the main menu. So, using an example, if someone is entering enrollment information, they would definitely need a student and a course. If the course has...
8
2739
by: sara | last post by:
I am learning Access and programming. I wanted to have the user select the departments for an ad from the list of all departments. Found code (that I could understand) on this site, and it works. But I have 2 quesitons: 1. How can I REMOVE a selection from the Destination List box - and keep the others there? My first code removes ALL from the Source list; this code does nothing. 2. How can I now USE the data - I have to...
15
4761
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
1
6421
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and binding it to a repeater control. This repeater control has multiple text boxes and buttons. Can you please tell me how can i do paging in this case ? I'm posting my code below. The problem is that if i click on "AdjustThisAd" button, it opens...
7
2664
by: Pam | last post by:
When I double click on a event in a form I want it to bring up another form and load the same data so it can be edited. I'm having a hard time doing this. The new form loads;but my file can't be found. Can you can me some ideas on how to do this. Please help!!
5
4738
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event gets triggered and the double click is not identified at all. Is there any way I can invoke the double click when the mouse move also exists?
1
7345
by: kingster | last post by:
Hi, I have a regular dataset and all i want to do is make a pivot table display in a browser with the datasource of the pivot table to be this dataset and then the end-user will be able to do whatever they want ... i dont need to do any special formatting just a straigh ot pivot tables usign sql server, asp.net, vb.net, OWC 10
1
5733
by: garry.oxnard | last post by:
Can anyone help me to solve a problem which involves switching from Access to Excel (then back to Access) programatically please? I have an Excel template which, on open, also opens an Access database - containing a list of addresses. Sequence of events is = (1) Excel template opens in its default XXX.xls filename. (2) Code runs to save the spreadsheet as XXX.xls. (3) User clicks a button to open an Access database containing an
0
8578
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8998
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...
1
8854
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
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
7668
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...
1
6494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5841
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
4345
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
2278
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.