DataGrid with wpf in vb.net not working -


here vb code

imports system.data 

imports system.data.sqlclient class mainwindow

private sub button1_click(sender object, e routedeventargs) handles button1.click        dim cmd sqlcommand = new sqlcommand("select qnumber tencmpc1", new sqlconnection(" server=(localdb)\projects;database=question;uid=sa;pwd=12345;"))     try                dim adp new sqldataadapter(cmd)         cmd.connection.open()         dim ds dataset = new dataset          adp.fill(ds, "qnumber")         grid.itemssource = ds.defaultviewmanager             'dim adp new sqldataadapter(cmd)         'cmd.connection.open()         'dim ds new dataset()         'adp.fill(ds)         'grid.itemssource = ds         'cmd.executereader()          ''grid.databind()          'adp.dispose()         'ds.dispose()          'cmd.connection.dispose()      catch ex exception         txt1.text = ex.message        end try   end sub 

end class

<window x:class="mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid margin="0,0,-409,0">     <button x:name="button1" content="button" horizontalalignment="left" margin="47,28,0,0" verticalalignment="top" width="101" height="55"/>     <label x:name="lbl1" content="label" horizontalalignment="left" margin="345,43,0,0" verticalalignment="top"/>     <textbox x:name="txt1" horizontalalignment="left" height="23" margin="174,47,0,0" textwrapping="wrap" text="textbox" verticalalignment="top" width="120"/>     <datagrid x:name="grid" horizontalalignment="left" margin="47,117,0,0" verticalalignment="top" height="149" width="417"/>   </grid> 

above xaml code in wpf project project run no error connention eshtablish data not populate doing wrong please guide me?


Comments

Popular posts from this blog

Java 3D LWJGL collision -

methods - python can't use function in submodule -

c# - ErrorThe type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?) -