473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

This code nukes DataBindings

When I had this code commented out, everything ran fine. But as soon as
I uncommented it, it nuked the databindings for every field bound to the
dataset. Does anybody know what's wrong with it?

try
{
if (dataSet11.MyTable[0].stringfield1.Length == 0)
check1.Checked = true;
else
check1.Checked = false;
}

catch (StrongTypingException ex)
{
// fld1 is null
check1.Checked = true;
}
sandman

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
2 990
Max Sandman wrote:
Does anybody know what's wrong with it?


Are you trying to check the value of a particular field for a given row
within the table? If so, your code should look more like this:

if (dataSet.Tables[0].Rows[0]["stringfield1"].ToString().Length == 0)

As far as I know, DataSets don't have a MyTable property nor do
DataTables have a stringfield1 property.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
Nov 15 '05 #2
When you use the designer to create a strongly typed dataset then the
tables, columns, and row fields are accessible using properties, instead of
indexed Table and Row collections.

Chris

"Frank Oquendo" <fr****@acadx.com> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
Max Sandman wrote:
Does anybody know what's wrong with it?


Are you trying to check the value of a particular field for a given row
within the table? If so, your code should look more like this:

if (dataSet.Tables[0].Rows[0]["stringfield1"].ToString().Length == 0)

As far as I know, DataSets don't have a MyTable property nor do
DataTables have a stringfield1 property.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com

Nov 15 '05 #3

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

Similar topics

20
by: Market Mutant | last post by:
www.51.ca is a nice site, and I want to build something similar and wonder if anyone knows if they are using PHPNuke or other nukes or they wrote everything themselves. What is the signature thing...
3
by: Me | last post by:
Hi Folks I keep recieving the following error message when i try to bind a combobox to the value that is in a textbox. the application crashes on the following line... Me.CBoxTitle.SelectedItem...
3
by: DraguVaso | last post by:
Hi, I'm having the following situation: - A class clsFournisseur with public property's which raise a MyPropertyChanged-event in the Set-method for each Property. Public Event NomChanged As...
9
by: HAN(removethis)twister | last post by:
I've tried to create 11 textboxes as variables (not actually visible in the program, not in Windows Form Designer) and have set DataBindings to the text properties of the TextBoxes BUT according to...
22
by: Gary | last post by:
I have been trying to update a record that I edited and can't seem to figure out what I'm missing. Here is the code that I have to load the record on the form: '...
1
by: Manuel Canas | last post by:
Hey guys, This code was posted by Cor Ligther some rows below here. hey bud if you read this one can you help me out here or anybody that know the answer to this one. How would I add a second...
3
by: Frustrated Developer via DotNetMonster.com | last post by:
I have developed a form that would allow the user to load and search a database several ways, by data range, by specific number or all database entries. I can successfully load any of the ways...
0
by: Al | last post by:
I'm trying to use ComboBox on Windows Form. I create and set DataBinding and DataTable objects I create a couple of Procedures: Private Sub ClearBindings() cbTakeOffPerson.DataBindings.Clear()...
0
by: reidarT | last post by:
In a datagrid I use different dataadapters (controlled by buttons) I also have a texbox with a databindings.text = tableadapter How do I programmatically change the textbox' databindings I have...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...
0
agi2029
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,...

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.