How to use public datasets in windows form

T

Tore Gylver

I have a Windows client with an MDI parent form and a
number of MDI child forms. Data for a number of
comboboxes throughout my windows client are collected
from web services at startup. This results in some read
only datasets in my MDI parent form.

The problem is that I cannot figure out how my comboboxes
can make use of the datasets in the parent form.



Here is one piece of code for a child form I have tried
without success:

FormMenu is the MDI parent form
DS_OrdergetStates is a dataset in FormMenu that is PUBLIC
Dataview1 is a local dataview in the child form
ComboStateOfOrders is the local combobox in the child form

Dim FormM As New FormMenu
DataView1.Table = FormM.DS_OrderGetStates1.Tables
("PN_States")
With ComboStateOfOrders
.DataSource = DataView1
.DisplayMember = "StateName"
.ValueMember = "StateCode"
End With




Resulting number of rows in combobox is always 0.

I have tested without a local dataview, and I have also
tried to establish a method to copy dataset from the
parent form to the child form, always with 0 rows in the
combobox as result. However, it looks like the dataset
schema is available in the child form.

Regards

Tore
 
D

Duke Sun

I'm now perform research on the issue and will update you as soon as
possible.

Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
D

Duke Sun

After extensive research on the issue, I can't reproduce the issue on my
side. Could you please provide a sample to reproduce the issue?

Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
T

Tore Gylver

This is what I learned the last days, I finally solved my
problem myself:

All windows forms are belonging to a class. Forms are
initialized with a constructor containing the NEW
keyword. The constructor is a procedure in the child
form. The constructor procedure allowed me to pass the
dataset to the child form as a parameter. Then the
codelines to databinding of the combobox worked ok.

Tore
 
Y

Ying-Shen Yu

Hi Tore,
Have you tested if the selection changed in one combobox will affect others?
I'm not sure if you should use dataset.copy method in your New method of the
MDI forms.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top