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

Strongly typed data - the 'current row'

I've got a Windows Forms app talking to an Access db, and I'm
experimenting with VS2005's form data binding stuff etc.

I've got a dataset, a datagridview bound to a query (let's call it
Customers), and I have a button called Edit, which when clicked should
spawn a dialog wherein the customer associated with the current row in
the grid should be edited.

So I need to pass the 'current' Customer ID to this form. There's an
topic in the help titled "Walkthrough: Passing Data Between Forms in a
Windows Application" wherein a similar thing happens: to quote,

"Using the customers and orders tables from Northwind one form will
allow users to select a customer and a second form will display the
selected customer's orders. This walkthrough shows how to create a
method on one form that receives data from the first form."

The relevant part of the walkthrough is this:

Private Sub CustomersDataGridView_DoubleClick(ByVal sender As Object,
ByVal e As System.EventArgs) _
Handles CustomersDataGridView.DoubleClick

Dim SelectedRowView As Data.DataRowView
Dim SelectedRow As NorthwindDataSet.CustomersRow

SelectedRowView = CType(CustomersBindingSource.Current,
System.Data.DataRowView)
SelectedRow = CType(SelectedRowView.Row,
NorthwindDataSet.CustomersRow)

Dim OrdersForm As New Form2
OrdersForm.LoadOrders(SelectedRow.CustomerID)
OrdersForm.Show()
End Sub

My question is - what's with all these CTypes? I've (or rather, the IDE
has) gone to all this trouble to make a whole bundle of strongly-typed
types for my dataset, my datatables, my tableadapters, my columns, my
rows, change events etc etc (the xsd file is enormous when you look at
it in code!) - and yet just to say 'the current value of column X for
data object Y' I have to do 2 CTypes?

Surely there's a cleaner way of just saying 'the current customer ID' ?

--
Larry Lard
Replies to group please

Feb 10 '06 #1
1 1538
CMM
Bind the CustomerId to a control on the form (hidden or otherwise) and pick
it up from that and bypass having to use the navigator objects to get it.

OrdersForm.LoadOrders(Me.CustomerIDLabel)

--
-C. Moya
www.cmoya.com
Feb 10 '06 #2

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

Similar topics

0
by: Uchiha Jax | last post by:
I have used this method many a time in previous applications without any hitches at all and i'm trying to use it in my current application and it isn't working. The only difference I can see is...
0
by: Uchiha Jax | last post by:
When using a strongly typed dataset (generated from the Visual Studio IDE from an XSD file) and databinding I get a really odd error when binding to both a combox and a datetimepicker. I bind...
1
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a...
1
by: Ersin Gençtürk | last post by:
I have 2 typed data tables inherited from the same dataset schema One called : table A with an identity column x column x is constrained to be unique. Other one is : table B with an identity...
1
by: PeterH | last post by:
I am developing a web service in VB.Net that returns data from a server. I have an .asmx page that uses a strongly typed dataset and I would like to return data in the form of strongly typed data...
0
by: Scott_from_Carematic | last post by:
I'm trying to use a strongly typed dataset in my asp.net (2.0) project with visual studio 2005. I have generated the dataset and tableadapters in the designer. I'm using SQL server EE 2005 as the...
4
by: Ted Ngo | last post by:
I create a northwind Strongly Typed TableAdapters dataset, the create a query like "select a, b, c, d from employeetable" then bind it into the gridview dim t as new northwindTableAdapters...
1
by: Code Monkey | last post by:
Silly question maybe, but I've been doing the following for far too long now: public static DataTable myDataTable() { string sql = @"SELECT column1, column2, column3, column4 FROM...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
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...

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.