Think this is simple but im lost:(

  • Thread starter Thread starter MadCrazyNewbie
  • Start date Start date
M

MadCrazyNewbie

Hey Group,

Im Sure this is simple but I carn`t seem to find any info anywhere:(

I have 2 x Forms: Form 1 has a DataConnecter and several DataAdapters on it,
all bound together in my DataSet.

On My Table(Faxs) I have a relationship to another Table(MeterReadings), on
my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid
on my Form1, and click Meter Reading, it loads up Form2 with a Datagrid that
only shows me the meter Readings for the Fax Row I selected on Form 1? If
you get what I mean

Any Links Are help would be greatly appriciated.

Many Thanks
MCN
 
MadCrazyNewbie said:
Hey Group,

Im Sure this is simple but I carn`t seem to find any info anywhere:(

I have 2 x Forms: Form 1 has a DataConnecter and several DataAdapters on it,
all bound together in my DataSet.

On My Table(Faxs) I have a relationship to another Table(MeterReadings), on
my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid
on my Form1, and click Meter Reading, it loads up Form2 with a Datagrid that
only shows me the meter Readings for the Fax Row I selected on Form 1? If

DataRow dro = DataTable.Rows[dataGrid.SelectedRowIndex];

then pass dro to your new form. You can either create a property in the new
form, or create an overloaded constructor or function that takes a datarow
as a param and then bind to it.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
 
William Thanks for your Reply.

How do you mean pass dro to a new form? or create a overload constructor? -
Sorry im fairly new at it all:(

Many Thanks
MCN

William Ryan eMVP said:
MadCrazyNewbie said:
Hey Group,

Im Sure this is simple but I carn`t seem to find any info anywhere:(

I have 2 x Forms: Form 1 has a DataConnecter and several DataAdapters on it,
all bound together in my DataSet.

On My Table(Faxs) I have a relationship to another Table(MeterReadings), on
my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid
on my Form1, and click Meter Reading, it loads up Form2 with a Datagrid that
only shows me the meter Readings for the Fax Row I selected on Form 1?
If

DataRow dro = DataTable.Rows[dataGrid.SelectedRowIndex];

then pass dro to your new form. You can either create a property in the new
form, or create an overloaded constructor or function that takes a datarow
as a param and then bind to it.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
you get what I mean

Any Links Are help would be greatly appriciated.

Many Thanks
MCN
 
on your second form:


Private _RowHolder As DataRow

Public Property RowHolder() As DataRow

Get

Return _RowHolder

End Get

Set(ByVal Value As DataRow)

_RowHolder = Value

End Set

End Property

Public Sub New(ByVal _Holder As DataRow)

Me.RowHolder = _Holder

End Sub



Then, no form1 use Dim frm as New
SecondGridForm(DataTableName.Rows[DataGrid.CurrentRowIndex])
frm.ShowDialog ' or .Show() depending on your needs
Then, once it's set you can do whatever you want on frm. Howver, if you
need the value you'll have it via frm.RowHolder as long as you remember to
reference on the second form with me.RowHolder

HTH,

Bill
www.devbuzz.com
www.knowdotnet.com


MadCrazyNewbie said:
William Thanks for your Reply.

How do you mean pass dro to a new form? or create a overload constructor? -
Sorry im fairly new at it all:(

Many Thanks
MCN

William Ryan eMVP said:
MadCrazyNewbie said:
Hey Group,

Im Sure this is simple but I carn`t seem to find any info anywhere:(

I have 2 x Forms: Form 1 has a DataConnecter and several DataAdapters
on
it,
all bound together in my DataSet.

On My Table(Faxs) I have a relationship to another
Table(MeterReadings),
on
my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid
on my Form1, and click Meter Reading, it loads up Form2 with a
Datagrid
that
only shows me the meter Readings for the Fax Row I selected on Form 1?
If

DataRow dro = DataTable.Rows[dataGrid.SelectedRowIndex];

then pass dro to your new form. You can either create a property in the new
form, or create an overloaded constructor or function that takes a datarow
as a param and then bind to it.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
you get what I mean

Any Links Are help would be greatly appriciated.

Many Thanks
MCN
 
Back
Top