By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

1 datagrid, multiple tables and tablestyles

P: n/a
Hi,
I have a vb.net application where I need multiple "Lookup windows".
I could make 10 lookup window with each there own datagrid and table
style, but I want to do it Nice.
I was thinking about 1 Lookupwindow with 2 parameters (SQL and the
tablestyle).
The problem is: When calling the lookup window, it works ok. But when
calling another Lookup window the table style won't update. (it still
uses the first one).

Anybody an idea?

Thanks in advance.

I use:
dsLookup.Clear()
cCommand = frmMain.GlcCommand
' create a data adapter
Dim daStudy As OleDbDataAdapter = New
OleDbDataAdapter(cCommand, frmMain.myConnection)
dsLookup.Clear()
dsLookup.DataSetName = frmMain.GlcTS
'daStudy.Update(dsLookup, frmMain.GlcTS)
' fill dataset
daStudy.TableMappings.Clear()
daStudy.Fill(dsLookup, frmMain.GlcTS)

Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Henk,

I had this problem as well. The most simple solution was than always to set
tablestyle zero to nothing and than add the needed one.

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
Hi

Thanks for your answer.
I made 2 tablestyles with the properties window of the datagrid.
Did you make the tablestyles with code?
Maybe you have an example??

Thanks
Henk,
The Netherlands

Nov 21 '05 #3

P: n/a
Henk,

More than one, however here is the most simple one look for the rest
yourself.

http://www.vb-tips.com/default.aspx?...6-3300b2215049

I hope this helps,

Cor
Nov 21 '05 #4

P: n/a
dgLookup1.TableStyles(0) = Nothing

I get "item is readonly"

Nov 21 '05 #5

P: n/a
Hi,

"henk" <ri*******@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi

Thanks for your answer.
I made 2 tablestyles with the properties window of the datagrid.
Ok, so did you set a MappingName for each table style ? When you bind to a
grid then the name of the DataTable is used to find the TableStyle with an
equal MappingName and that one will be used.

So make sure that your tables have the right TableName and that each
DataGridTableStyle has the right MappingName.

Public Sub BindGrid( Query As String, TableName As String )
Dim lookupAdapter As OleDbDataAdapter =
New OleDbDataAdapter( Query, frmMain.myConnection)

Dim lookupTable As New DataTable( TableName )
lookupAdapter.Fill( lookupTable )

LookupDataGrid.DataSource = lookupTable
End Sub
Did you make the tablestyles with code?
You could also do that, but it's not entirely clear whether you want to keep
all TableStyles in the LookupForm or not.

HTH,
Greetings
Maybe you have an example??

Thanks
Henk,
The Netherlands

Nov 21 '05 #6

P: n/a
Henk,

Sorrry a litle bit "te kort door de bocht"
:-)
DataLookup1.TableStyles.RemoveAt(0)

I hope this helps better,

Cor
Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.