473,326 Members | 2,013 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,326 software developers and data experts.

Help passing and binding to a dataset please.

I am using windows forms and vb.net.

My problem is a little complex so please bear with me.

I have written an application that references a .com based API linked to an external
client application.
The API exposes client user interface objects. One of the objects is similar to a grid.

The first part of my application creates a reference to the grid object in the client
application.
Now, I take that object and pass it to a class I have created in a class library that
accepts that object type in its constructor.

My class only has one function and that takes the gridlike object and converts/returns it
as an untyped dataset.

Let me say that the code to this point the code seems to be working just fine. The
returned dataset can be written out as XML and it all looks good.

The problem comes here:

I tried to create a new form class that accepts a dataset in its constructor. I pass it
a dataset that I have returned from the class detailed above.

During the form load, I try to databind to the dataset and I run into an endless loop of
some sort. The grid never appears, the data never bind etc.

I know I am missing something. I thought I might be able to pass datasets around in this
manner but perhaps I cannot. I know I can do work arounds but I am interested in the
answer as to why this doesn't work.
PSEUDO_CODE

//////////////////////////////////////////////////
MAIN APPLICATION
''Has reference to com API of client user interface

Private _MyDataset as dataset

Sub CatchAnEvent()
Dim MyClientInterfaceGridObject
Dim New MyClass(MyClientInterfaceGridObject)
_MyDataset = MyClass.ReturnDatasetFromGridlikeObject
''All is good to here. If I write the xnl out of the dataset it looks fine.

Dim MyNewForm as new form1(_MyDataset)
MyNewForm.show ''Here is where the problem occurs. MyNewForm gets stuck loading

End Sub
//////////////////////////////////////////////////

//////////////////////////////////////////////////
FORM1
''Plain old windows form. I have altered the "New" to accept a dataset
Private _ds as dataset
Public Sub New(byVal ds as dataset)
MyBase.New()
InitializeComponent()
_ds = ds
End Sub
Private Sub FormLoad
'I have tried a number of methods of databinding with two different grids...
'Here is the last one I tried using an MS grid...
datagrid1.setdatabinding(_ds, _dsTables(0).Tablename)
End Sub

///////////////////////////////////////////////////
Any help would be appreciated. I am wondering if I might have to do some serialization to
create something I can bind to when passing an untyped dataset around like this.

Thanks in advance!
Nov 21 '05 #1
5 1161
I started doing some additional debugging and it may be that there is a problem loading
forms in the threading model that is in use in my solution, not in the manner I was
passing datasets around with.

Nov 21 '05 #2
Darious,

Any reason that you do not show it to us in the normal way with a standard
datagrid

datagrid1.datasource = ds.tables(0) 'I assume

Cor
Nov 21 '05 #3
Cor:

You have been around here for a million years. Maybe you can help. It seems that my
problem has nothing to do with datasets. It has to do with simple form loading.

If I instantiate and show form1 in the "New" sub of my main application, the form loads
just fine. However, if I try to show it in a different sub (an item event sub) the form
gets hung. If I hoved the mouse on it, there is an hourglass.
The sub I am trying to load it from looks like this:

Private Sub ClientApplication_ItemEvent(Byval X, ByRef Y as itemEvent, ByRef Z as bool)
handles ClientApplication.ItemEvent
''In this sub, I trap an item event and simply try to load the form....
If Y=MyCriteria then
Dim MyForm as form1
MyForm.show
End If
End Sub

The exact same form loads just fine if I dim it and load it when my application class is
instantiated.
If I do it in the manner above, the form hangs on load.

Any idea what is blocking? How might I get around this?

Thanks!
Nov 21 '05 #4
Darius

Private Sub ClientApplication_ItemEvent(Byval X, ByRef Y as itemEvent,
ByRef Z as bool)
handles ClientApplication.ItemEvent
''In this sub, I trap an item event and simply try to load the form....
If Y=MyCriteria then
Dim MyForm as form1
MyForm.show
End If
End Sub

MyForm1 should in my opinion in this statement be nothing and absolute not
work.
(There should be an error be showed)

Cor
Nov 21 '05 #5
Like Cor said, it won't work. myform has not been instantiated to anything
since you only delcared it's type, not an instance of the type. This is
pretty basic so you should be able to figure it out from here.

"Darious Snell" wrote:
I started doing some additional debugging and it may be that there is a problem loading
forms in the threading model that is in use in my solution, not in the manner I was
passing datasets around with.

Nov 21 '05 #6

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

Similar topics

1
by: Steven | last post by:
Hi all My problem is a little lengthy. But please help me. In my application, ADO.NET DataSet object is not getting constructed in the Web Service Web Method called by the Windows Application...
2
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
4
by: DOTNET | last post by:
Hi, Anybody help me regarding this error: I am assigning the values to the session variables when the button is clicked and passing these session variables to the next page and when I am...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
7
by: Richard | last post by:
I have a form with seven tapages. These span only one record with a large number of fields (textboxes). On Tabpage1 I display a number of read-only text boxes. This displays information about...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
0
by: Magnus Bergh | last post by:
I am developing an application for pocketpc and this involvs a but of juggling with different forms. I have an "order entry" type of application. On the main form I have a grid which displays...
0
by: John Sheppard | last post by:
Hello there, I am wanting to pass my datasets by reference to other forms. As soon as I do that I have to reset any binding sources by setting their datasource property to the original...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.