473,563 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ctype Datasource to DataTable .. always empty?

The below always results in an empty table, when I know the Gridview
has rows.

Dim dataTable As DataTable = CType(ChargeGri dView.DataSourc e,
DataTable)
If Not (dataTable Is Nothing) Then '****** (THIS IS ALWAYS
FALSE) ****

Is there a correct way to do this?

Oct 23 '06 #1
1 6028
I think you should try to display the dataTable of the dataSet that you
originally set the ChargeGridView. DataSource to

say

Dim ds as DataSet
'Fill ds with data
ChargeGridView. DataSource = ds

'now you can access the data in the ds
Dim dataTable As DataTable = ds.tables(0)
On Oct 23, 12:43 pm, "jobs" <j...@webdos.co mwrote:
The below always results in an empty table, when I know the Gridview
has rows.

Dim dataTable As DataTable = CType(ChargeGri dView.DataSourc e,
DataTable)
If Not (dataTable Is Nothing) Then '****** (THIS IS ALWAYS
FALSE) ****

Is there a correct way to do this?
Oct 23 '06 #2

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

Similar topics

0
1180
by: Jon Brunson | last post by:
I've got a very weird problem, when I run the following code the ComboBox (Me.cmbInputDevice) is always empty. The ComboBox is on a UserControl in a Class Library. I'm using VS.NET 2003 with SourceSafe 6.0d (the problem occurs whether the code is checked in or out) If I step through the code, The line Me.cmbInputDevice.DataSource = dv ...
0
1754
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not happened always whenever DataSource is set, only called sometimes, in a series of setting DataSource, I could get this setting focus only one time ....
3
1753
by: Alexander | last post by:
Hi, I am using a DataGrid and assign a DataTable as a DataSource to it: void ShowData() { DataTable myNewDataTable = new DataTable(); ... // fill table this.m_DataGrid1.DataSource = myNewDataTable; this.Refresh(); }
4
22204
by: kids_pro | last post by:
Hi, On form_load() I bind a combobox to a dataset and listbox to a datatable. When I want to unbind it I call comboBox1.DataSource = null, listBox1.DataSource = null It unbind but the Items still persist in the comboBox and listBox. I expect it to be empty list. Can anyone tell me how to unbind the comboBox and automatically clear it
2
2667
by: carballosa | last post by:
Hi guys, I need to use a one row datagrid in my asp.net 1.1 application. The data source will contain 1 or 0 entries. When no rows of data are present I want to show an empty row in the datagrid (ie. with empty cells). Unfortunatly I get no datagrid shown instead. Any idea how I can force the datagrid to show with an empty row? Best...
3
3507
by: DraguVaso | last post by:
Hi, I'm trying to use tha DataGridView of .NET 2. But it doesn't seem to have something like a tablestyle, permitting you to show only some columns of the DataSource andn ot all of them. Does anybody knows how to do this? I want for exemple not that the ID of my records are shown in the DataGridView etc. Thanks a lot in advance,
3
1388
by: Richard Ryerson | last post by:
I have a general DataGridComboBoxColumn that I built using the Example in the .NET 2003 Combined Collection help file (that was a data time picker). I am able to assign a data source and display / value members so the ComboBox is data bound and that works, to a point. What generally works is the ComboBox get's populated and the ComboBox...
7
2601
by: ThunderMusic | last post by:
Hi, This question probably went back a couple of times, but I didn't find anything about it on google, so I ask here... What is the best way to use the DataSource/DataBind pattern in a class? I would like the user to be able to set a data source and I'd like my class to be able to use this datasource to build a DataTable I could use for...
0
1251
by: Sylviarabi | last post by:
Hi I am wokrin on a website where i hav a grid view displaying data from an SQL table accordin to the customer chosen in the dropdown list in the update panel. This works fine but i am havin trouble with the sorting when i click on the column name.Also paging does not work.The following are the functions i used: private string...
0
7665
marktang
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...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
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...
0
7950
tracyyun
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...
1
5484
isladogs
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...
0
5213
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...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
924
bsmnconsultancy
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...

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.