Simplest way to use datagrid in VB.Net

[b][red]This message was edited by IdleTask at 2003-1-30 10:47:53[/red][/b][hr]
Hello,

I am new to .Net and having some problems with the datagrid in Windows Forms. (I have used it fine in an ASPX page, but when I try it with a Windows form, nothing happens)

Here is what I do

1) Create the SQLConnection (to local SQL database) the connection string works fine.

2) Put a data adapter on the form, I go through the wizard that starts, pick my connection, choose the procedure I want to use (which I have tested)

3) Right click on the data adapter, and choose Configure Dataset. I go through that wizard too, and can preview the data.

4) Put a datagrid control on the form, and set the datasource property in the designer (not the form code) to my data adapter, and set the data member to my procedure (all these things appear as options in the designer)

When I do this, I see the colums on the datagrid that the procedure returns.

When I run it, I see nothing and get no errors.

Any help is appreciated.

PS-- I recently bought Corriolis's VB.Net Black Book and follow a step by step example (which is where my steps above come from) and it doesnt work in the example either.


Comments

  • First you have to fill the dataset.
    I have had the same problem.

    Place fill code like below in your form load event.

    Me.OleDbDataAdapter1.SelectCommand.Connection = myconn
    Me.OleDbDataAdapter1.Fill(dataset)


    : [b][red]This message was edited by IdleTask at 2003-1-30 10:47:53[/red][/b][hr]
    : Hello,
    :
    : I am new to .Net and having some problems with the datagrid in Windows Forms. (I have used it fine in an ASPX page, but when I try it with a Windows form, nothing happens)
    :
    : Here is what I do
    :
    : 1) Create the SQLConnection (to local SQL database) the connection string works fine.
    :
    : 2) Put a data adapter on the form, I go through the wizard that starts, pick my connection, choose the procedure I want to use (which I have tested)
    :
    : 3) Right click on the data adapter, and choose Configure Dataset. I go through that wizard too, and can preview the data.
    :
    : 4) Put a datagrid control on the form, and set the datasource property in the designer (not the form code) to my data adapter, and set the data member to my procedure (all these things appear as options in the designer)
    :
    : When I do this, I see the colums on the datagrid that the procedure returns.
    :
    : When I run it, I see nothing and get no errors.
    :
    : Any help is appreciated.
    :
    : PS-- I recently bought Corriolis's VB.Net Black Book and follow a step by step example (which is where my steps above come from) and it doesnt work in the example either.
    :
    :
    :

  • I'm sorry I don't use it in Windows forms but could you help me with web forms? I figured out how to embed a dropdownlist and listbox in a datagrid bit cannot get it to write to the datagrid or SQL 2000 database. Help, please! lee8mm@yahoo.com
    ~~Lee

    : [b][red]This message was edited by IdleTask at 2003-1-30 10:47:53[/red][/b][hr]
    : Hello,
    :
    : I am new to .Net and having some problems with the datagrid in Windows Forms. (I have used it fine in an ASPX page, but when I try it with a Windows form, nothing happens)
    :
    : Here is what I do
    :
    : 1) Create the SQLConnection (to local SQL database) the connection string works fine.
    :
    : 2) Put a data adapter on the form, I go through the wizard that starts, pick my connection, choose the procedure I want to use (which I have tested)
    :
    : 3) Right click on the data adapter, and choose Configure Dataset. I go through that wizard too, and can preview the data.
    :
    : 4) Put a datagrid control on the form, and set the datasource property in the designer (not the form code) to my data adapter, and set the data member to my procedure (all these things appear as options in the designer)
    :
    : When I do this, I see the colums on the datagrid that the procedure returns.
    :
    : When I run it, I see nothing and get no errors.
    :
    : Any help is appreciated.
    :
    : PS-- I recently bought Corriolis's VB.Net Black Book and follow a step by step example (which is where my steps above come from) and it doesnt work in the example either.
    :
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories