472,334 Members | 1,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 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 1101
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...
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...
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...
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...
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...
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...
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....
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.