Hi
Every body
I m not able to get dataset or datatable from datagrid.
Now I m trying this code but this is always returns nothing.
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim tbl As New DataTable
Dim ds As New DataSet
Dim dr As DataRow
tbl.Columns.Add ("Col1")
tbl.Columns.Add ("Col2")
dr = tbl.NewRow
dr("Col1") = "Neeraj"
dr("Col2") = "Pankaj"
tbl.Rows.Add(dr )
ds.Tables.Add(t bl)
DataGrid1.DataS ource = ds
DataGrid1.DataB ind()
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Dim ds As DataSet
ds = CType(DataGrid1 .DataSource, DataSet)
DataGrid2.DataS ource = ds
DataGrid2.DataB ind()
End Sub
Command button1 working successfully but command button2 not working
I got ds = nothing when I execute command button2 code
Please help me. 3 8409
neeraj wrote:
Hi
Every body
I m not able to get dataset or datatable from datagrid.
Now I m trying this code but this is always returns nothing.
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim tbl As New DataTable
Dim ds As New DataSet
Dim dr As DataRow
tbl.Columns.Add ("Col1")
tbl.Columns.Add ("Col2")
dr = tbl.NewRow
dr("Col1") = "Neeraj"
dr("Col2") = "Pankaj"
tbl.Rows.Add(dr )
ds.Tables.Add(t bl)
DataGrid1.DataS ource = ds
DataGrid1.DataB ind()
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Dim ds As DataSet
ds = CType(DataGrid1 .DataSource, DataSet)
DataGrid2.DataS ource = ds
DataGrid2.DataB ind()
End Sub
Command button1 working successfully but command button2 not working
I got ds = nothing when I execute command button2 code
Please help me.
Did you click button two after button one? Since the first button sets
DataGrid1's DataSource, the second button canot refer to it until after
the first button is clicked.
Check right after "ds = CType(DataGrid1 .DataSource, DataSet)".
Also, the DataBind may be gratuitous. So far, i have found no need for
them in my project.
B.
Brian Tkatch wrote:
neeraj wrote:
Hi
Every body
I m not able to get dataset or datatable from datagrid.
Now I m trying this code but this is always returns nothing.
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim tbl As New DataTable
Dim ds As New DataSet
Dim dr As DataRow
tbl.Columns.Add ("Col1")
tbl.Columns.Add ("Col2")
dr = tbl.NewRow
dr("Col1") = "Neeraj"
dr("Col2") = "Pankaj"
tbl.Rows.Add(dr )
ds.Tables.Add(t bl)
DataGrid1.DataS ource = ds
DataGrid1.DataB ind()
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Dim ds As DataSet
ds = CType(DataGrid1 .DataSource, DataSet)
DataGrid2.DataS ource = ds
DataGrid2.DataB ind()
End Sub
Command button1 working successfully but command button2 not working
I got ds = nothing when I execute command button2 code
Please help me.
Did you click button two after button one? Since the first button sets
DataGrid1's DataSource, the second button canot refer to it until after
the first button is clicked.
Check right after "ds = CType(DataGrid1 .DataSource, DataSet)".
Also, the DataBind may be gratuitous. So far, i have found no need for
them in my project.
B.
Boyishly i Click button2 after button1 click , but button2 click not
get datasource from datagrid. and also Datagrid1.Datas ource returns
nothing .
neeraj wrote:
Brian Tkatch wrote:
neeraj wrote:
Hi
Every body
I m not able to get dataset or datatable from datagrid.
Now I m trying this code but this is always returns nothing.
>
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
>
Dim tbl As New DataTable
Dim ds As New DataSet
Dim dr As DataRow
>
tbl.Columns.Add ("Col1")
tbl.Columns.Add ("Col2")
dr = tbl.NewRow
>
dr("Col1") = "Neeraj"
dr("Col2") = "Pankaj"
>
tbl.Rows.Add(dr )
ds.Tables.Add(t bl)
>
DataGrid1.DataS ource = ds
DataGrid1.DataB ind()
End Sub
>
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Dim ds As DataSet
ds = CType(DataGrid1 .DataSource, DataSet)
DataGrid2.DataS ource = ds
DataGrid2.DataB ind()
End Sub
>
Command button1 working successfully but command button2 not working
I got ds = nothing when I execute command button2 code
Please help me.
Did you click button two after button one? Since the first button sets
DataGrid1's DataSource, the second button canot refer to it until after
the first button is clicked.
Check right after "ds = CType(DataGrid1 .DataSource, DataSet)".
Also, the DataBind may be gratuitous. So far, i have found no need for
them in my project.
B.
Boyishly i Click button2 after button1 click , but button2 click not
get datasource from datagrid. and also Datagrid1.Datas ource returns
nothing .
That is odd. It looks like somehow Datagrid1.Datas ource is being reset.
Add a breakpoint to you code, and watch what DataGrid1.DataS ource is
set to. The one line of code
DataGrid1.DataS ource = ds
sets it, but maybe it gets reset before the end of the sub?
B. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Wes |
last post by:
I want to use a DataGrid and manually populate the data in the table. Does
anyone know how this is done?? I want to create all the Columns, and then
just add rows as my Program runs. Is there something else I should be using
in C# than a DataGrid.
Thanks for the Help
|
by: a |
last post by:
I've read and split a delimited text file into a dataset.
It looks fine in a datagrid (5 columns and 5,000 rows),
but I've been trying, without success, to then insert
the resulting dataset called "result" into a single sql
table that has an auto-increment and PK column called ID,
as well as the 5 columns from the dataset.
Any suggestions on a way to perform the insert of the
"result" dataset into the sql table?
|
by: a |
last post by:
I've read and split a delimited text file into a dataset.
It looks fine in a datagrid (5 columns and 5,000 rows),
but I've been trying, without success, to then insert
the resulting dataset called "result" into a single sql
table that has an auto-increment and PK column called ID,
as well as the 5 columns from the dataset.
Any suggestions on a way to perform the insert of the
"result" dataset into the sql table?
|
by: Dave |
last post by:
Tried posting in the Winform Forum without much luck, so posting here...
After inserting a new data row to a DataTable that is bound to a
datagrid, I am unable to change data in a row that is after the newly
added row without getting bizarre results.
I have added the full code for the test below. Create a project drop
in the code and run. There is nothing crazy about the code. I used
the designer to add the dataset and to do the...
|
by: John Holmes |
last post by:
I have a web interface where the user types in ID's one at a time. After an
ID is typed in, a button is clicked and the button click event has code that
does a query and returns a data reader and then appends the data to a
dataset that is built in the Page_Load code in the if(!isPostBack) block.
When I try to add a row in the button click event code I get an error saying
that "Object reference not set to an instance of an object". I'm...
| |
by: Ben Becker |
last post by:
I am trying to build a custom crosstab type of grid where I take some items
in a data grid and based on the content of the current item compared to the
previous item, determine if a new row in a table should be created or not.
In order to do this, I need to have full control over the conditional logic
for how items get displayed within a repeater element which I'm not seeing
as possible.
How can I cursor through a data set, apply...
|
by: Bob Davies |
last post by:
Hi
I have a webservice that retrieves data from a database, this is then
returned to the calling client application built in windows forms within a
dataset, however upon attempting to create tablestyles to format any of the
columns within the datagrid, the exception "Can-not parent objects created
on one thread to objects created on another" or words to that effect.
I'm not too sure if what I said make sense, but i will add details to...
|
by: Datatable Dataset Datagrid help |
last post by:
Hi I am somewhat confused, I am new at VB.net
I use XML data,
I have a datagrid,
I created a datatable so that I can create a custom format like true is this
graphic false is this graphic and others.
One of the custom format is as follows:
dsmessages_dt.Columns.Add("Image", GetType(Image))
I had a problem of when I used a checkbox in the grid that was bound to the
datatable that it would not update my dataset. So I created another...
|
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 allow user to filter the first time,
when they tried the second time, the speficied cast error message will
prompt one....
I create a mydataset1 first, and the mydataset1 data source was getting from
DataGrid.DataSource.
|
by: Brian |
last post by:
I want to create an In Memory dataset. not connected to any database.. but
putting my own info in from code or a file....
What are the steps to do this? Where can I find some info on how to do
this?
Brian
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |