473,387 Members | 1,745 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.

What am I doing wrong?

Hi all,

The code below is part of a form where I would like the user to make
selections from a table. The data is brought into the form from another form
with:
Public WriteOnly Property DataSet() As DataSet
Set(ByVal Value As DataSet)
ResultGrid.DataSource = Value.Tables("tbSelect")
End Set
End Property

When the user clicks on a button "New Filter" the code below runs. On the
line "ResultGrid.DataMember = "tbTemp" the execution stops with the
following error: "Can't create a child list for field tbTemp"
Private Sub btNewFilter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btNewFilter.Click
Dim uSelect As String = "cindih"
ResultGrid.Visible = False
Dim strSearch As String = "user='" + uSelect + "'"
_dt = ResultGrid.DataSource
Dim tbTemp As DataTable
tbTemp = _dt.Clone()
Dim dRows() As DataRow = _dt.Select(strSearch, "")
Dim drSel As DataRow
For Each drSel In dRows
If Not drSel("hours") Is System.DBNull.Value Then
totHours = totHours + drSel("hours")
Else
drSel("hours") = 0
End If
tbTemp.ImportRow(drSel)
Next
ResultGrid.DataMember = "tbTemp"
ResultGrid.Visible = True
End Sub

What am I doing wrong here?

Thanks
Claus
Nov 21 '05 #1
8 1414
Replace the line: ResultGrid.DataMember = "tbTemp"
with: ResultGrid.DataSource = tbTemp

If the DataSource of a DataGrid is a DataTable, just set the property
directly to the Datatable.

If the DataSource of a DataGrid is a DataSet, then you can specify which
table in the DataSet you want to display using the DataMember property. The
TableName property for the DataTable within the DataSet would have to be set
also:

DS.Tables.Add(DT)
DS.Tables(0).TableName = "DT"
DG.DataSource=DS
DG.DataMember="DT"

www.charlesfarriersoftware.com
"cjobes" wrote:
Hi all,

The code below is part of a form where I would like the user to make
selections from a table. The data is brought into the form from another form
with:
Public WriteOnly Property DataSet() As DataSet
Set(ByVal Value As DataSet)
ResultGrid.DataSource = Value.Tables("tbSelect")
End Set
End Property

When the user clicks on a button "New Filter" the code below runs. On the
line "ResultGrid.DataMember = "tbTemp" the execution stops with the
following error: "Can't create a child list for field tbTemp"
Private Sub btNewFilter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btNewFilter.Click
Dim uSelect As String = "cindih"
ResultGrid.Visible = False
Dim strSearch As String = "user='" + uSelect + "'"
_dt = ResultGrid.DataSource
Dim tbTemp As DataTable
tbTemp = _dt.Clone()
Dim dRows() As DataRow = _dt.Select(strSearch, "")
Dim drSel As DataRow
For Each drSel In dRows
If Not drSel("hours") Is System.DBNull.Value Then
totHours = totHours + drSel("hours")
Else
drSel("hours") = 0
End If
tbTemp.ImportRow(drSel)
Next
ResultGrid.DataMember = "tbTemp"
ResultGrid.Visible = True
End Sub

What am I doing wrong here?

Thanks
Claus

Nov 21 '05 #2
Charlie,

You don't have any idea how grateful I am for your answer. I don't know how
many hours I have been trying to figure this one out. MSDN wasn't helpful
either.

Thanks again,

Claus
"Charlie" <cfarrier at charlesfarriersoftware.com> wrote in message
news:C1**********************************@microsof t.com...
Replace the line: ResultGrid.DataMember = "tbTemp"
with: ResultGrid.DataSource = tbTemp

If the DataSource of a DataGrid is a DataTable, just set the property
directly to the Datatable.

If the DataSource of a DataGrid is a DataSet, then you can specify which
table in the DataSet you want to display using the DataMember property. The TableName property for the DataTable within the DataSet would have to be set also:

DS.Tables.Add(DT)
DS.Tables(0).TableName = "DT"
DG.DataSource=DS
DG.DataMember="DT"

www.charlesfarriersoftware.com
"cjobes" wrote:
Hi all,

The code below is part of a form where I would like the user to make
selections from a table. The data is brought into the form from another form with:
Public WriteOnly Property DataSet() As DataSet
Set(ByVal Value As DataSet)
ResultGrid.DataSource = Value.Tables("tbSelect")
End Set
End Property

When the user clicks on a button "New Filter" the code below runs. On the line "ResultGrid.DataMember = "tbTemp" the execution stops with the
following error: "Can't create a child list for field tbTemp"
Private Sub btNewFilter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btNewFilter.Click
Dim uSelect As String = "cindih"
ResultGrid.Visible = False
Dim strSearch As String = "user='" + uSelect + "'"
_dt = ResultGrid.DataSource
Dim tbTemp As DataTable
tbTemp = _dt.Clone()
Dim dRows() As DataRow = _dt.Select(strSearch, "")
Dim drSel As DataRow
For Each drSel In dRows
If Not drSel("hours") Is System.DBNull.Value Then
totHours = totHours + drSel("hours")
Else
drSel("hours") = 0
End If
tbTemp.ImportRow(drSel)
Next
ResultGrid.DataMember = "tbTemp"
ResultGrid.Visible = True
End Sub

What am I doing wrong here?

Thanks
Claus

Nov 21 '05 #3
Claus,

The problem with most samples from MSDN is that they are with strongly typed
dataset and with let say raw datasets.

I mostly use in all my samples raw datasets. However because you started to
make a strongly typed dataset I went on that route. In the way I showed you
that sample, you can forever use the top reference of that strongly typed
dataset, therefore something as

ds.tables("KlausTable") in a table in the dataset while when you make it
strongly typed yuursel fit can be ds.KlausTable

a reference to a table can forever been set as
dim myTableRef as datatable = ds.tables("KlausTable")

I hope this gives some ideas.

Cor
"cjobes" <cj****@nova-tech.org>

You don't have any idea how grateful I am for your answer. I don't know
how
many hours I have been trying to figure this one out. MSDN wasn't helpful
either.

Thanks again,

Claus
"Charlie" <cfarrier at charlesfarriersoftware.com> wrote in message
news:C1**********************************@microsof t.com...
Replace the line: ResultGrid.DataMember = "tbTemp"
with: ResultGrid.DataSource = tbTemp

If the DataSource of a DataGrid is a DataTable, just set the property
directly to the Datatable.

If the DataSource of a DataGrid is a DataSet, then you can specify which
table in the DataSet you want to display using the DataMember property.

The
TableName property for the DataTable within the DataSet would have to be

set
also:

DS.Tables.Add(DT)
DS.Tables(0).TableName = "DT"
DG.DataSource=DS
DG.DataMember="DT"

www.charlesfarriersoftware.com
"cjobes" wrote:
> Hi all,
>
> The code below is part of a form where I would like the user to make
> selections from a table. The data is brought into the form from another form > with:
> Public WriteOnly Property DataSet() As DataSet
> Set(ByVal Value As DataSet)
> ResultGrid.DataSource = Value.Tables("tbSelect")
> End Set
> End Property
>
> When the user clicks on a button "New Filter" the code below runs. On the > line "ResultGrid.DataMember = "tbTemp" the execution stops with the
> following error: "Can't create a child list for field tbTemp"
>
>
> Private Sub btNewFilter_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btNewFilter.Click
> Dim uSelect As String = "cindih"
> ResultGrid.Visible = False
> Dim strSearch As String = "user='" + uSelect + "'"
> _dt = ResultGrid.DataSource
> Dim tbTemp As DataTable
> tbTemp = _dt.Clone()
> Dim dRows() As DataRow = _dt.Select(strSearch, "")
> Dim drSel As DataRow
> For Each drSel In dRows
> If Not drSel("hours") Is System.DBNull.Value Then
> totHours = totHours + drSel("hours")
> Else
> drSel("hours") = 0
> End If
> tbTemp.ImportRow(drSel)
> Next
> ResultGrid.DataMember = "tbTemp"
> ResultGrid.Visible = True
> End Sub
>
> What am I doing wrong here?
>
> Thanks
> Claus
>
>
>


Nov 21 '05 #4

"Cor Ligthert" <no************@planet.nl> wrote
... you can forever use the top reference ...
(you can always use the top reference)
... a table can forever been set as


(a table can always be set as)

Since you provide so many answers, it will be a big help
if we can slowly help you to post fluent English! :-)

Always - is conditional (in all ways..., at all times..., in all cases... etc.)
Forever - is a never ending expanse of time

EX1:
While humans must always breathe, no one breathes forever.
EX2:
These newsgroup posts always get copied to the Google
archive and may be forever available to everyone.
HTH
LFS
Nov 21 '05 #5
Larry,

I will keep an eye on it, my dictionary gives for both almost the same
translation word, in transslated words "all times" (still and will be) and
for ever = "all times" (start and endless). While the say that forever is
the same as ever.

However I will try to keep an eye on it.

The samples are clear, to translate them checking

Always continuing as long as is
Forever a fact

Thanks,

Cor

"Cor Ligthert" <no************@planet.nl> wrote
... you can forever use the top reference ...


(you can always use the top reference)
... a table can forever been set as


(a table can always be set as)

Since you provide so many answers, it will be a big help
if we can slowly help you to post fluent English! :-)

Always - is conditional (in all ways..., at all times..., in all cases...
etc.)
Forever - is a never ending expanse of time

EX1:
While humans must always breathe, no one breathes forever.
EX2:
These newsgroup posts always get copied to the Google
archive and may be forever available to everyone.
HTH
LFS

Nov 21 '05 #6

Larry,

While *they* say that forever is the same as "ever".
Only a typo.

By the way before you misunderstood this, "always" an "forever" is
translated as "altijd" in Dutch "al" = English "All" and "tijd" = "time".

Again thanks.

Cor
Nov 21 '05 #7
Hi Cor,

Guess I have figured out what neck of the woods you are in. Where in Holland
are you?

I'm in your Neighbourhood next week (France and Germany) with plane changes
in Amsterdam and Paris.

Claus
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

Larry,

While *they* say that forever is the same as "ever".
Only a typo.

By the way before you misunderstood this, "always" an "forever" is
translated as "altijd" in Dutch "al" = English "All" and "tijd" = "time".

Again thanks.

Cor

Nov 21 '05 #8
Hi,

Claus, interesting, I am almost true in the woods of Holland yes (and there
is not much wood here).

Amsterdam and Paris are my favorite places so I can only tell you that that
cannot be a bad idea.

Amsterdam
Nightlive, culture
Paris
Culture, shoping

There are a lot of other good places in Europe, however those two above are
my favorites.

However a little bit of object here these messages

:-))

Cor

"cjobes" <cj****@nova-tech.org>
Hi Cor,

Guess I have figured out what neck of the woods you are in. Where in
Holland
are you?

I'm in your Neighbourhood next week (France and Germany) with plane
changes
in Amsterdam and Paris.

Claus
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

Larry,

While *they* say that forever is the same as "ever".
Only a typo.

By the way before you misunderstood this, "always" an "forever" is
translated as "altijd" in Dutch "al" = English "All" and "tijd" = "time".

Again thanks.

Cor


Nov 21 '05 #9

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

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
11
by: Alfonso Morra | last post by:
Hi, I am at the end of my tether now - after spending several days trying to figure how to do this. I have finally written a simple "proof of concept" program to test serializing a structure...
46
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
2
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update...
16
by: Ajay | last post by:
Hi all, i want to know when i create a class.what all it contains.I know the following things are there by default if i do not declare them by myself.Please tell the other things that are left. ...
8
by: watkinsdev | last post by:
Hi, I have created a mesh class in visual studio 6.0 c++. I can create a device, render objects and can edit the objects by for instancnce selecting a cluster of vertices and processing the...
0
by: shapper | last post by:
Hello, I am creating a class with a control. I compiled the class and used it on an Asp.Net 2.0 web site page. I can see the begin and end tags of my control (<oland </ol>) but somehow the...
10
by: DavidSeck.com | last post by:
Hi, I am working with the Facebook API right now, an I have kind of a problem, but I don't know what I am doing wrong. So I have a few arrays, f.ex.: User albums: array(2) {
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...

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.