473,386 Members | 1,924 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,386 software developers and data experts.

missing text in a label

Howdy,

I'm having trouble getting a message to appear in a label.

I have the following code snippet:

lbErrorMssg.Text = ""
foreach (DataRow Rrow in ds.Tables["ImportCSV"].Rows)
{
string sString = Rrow["EmployeeNumber"].ToString();
if (!ImportCSV.IsNumeric(sString))
{
lbErrorMssg.Text = lbErrorMssg.Text + "EmployeeNumber " + sString +
"is not an integer. Please verify the EmployeeNumber." + "<BR>";
}
}

I know that this is catching non numeric entries because the label is
populated with as many error messages as I put errors in the text
data. However, the text of sString never appears in lbErrorMssg. I
replaced sString with Rrow["EmployeeNumber"].ToString(); but there was
no change. How can I make the value for the invalid EmployeeNumber
appear in the text of lbErrorMessage?

In case you are wondering what is "IsNumeric", it is a custom function
I made to mimic the built in IsNumeric function of vbscript, or isnan
from javascript.

--Terry
Nov 18 '05 #1
2 1327
Hi, Terry,

Did you try to debug the code? What is the value of sString shown in the
debugger? Maybe it is an empty string. Try printing sString.Length.

Hope this helps
Martin
"Terry" <NT********@msn.com> wrote in message
news:55**************************@posting.google.c om...
Howdy,

I'm having trouble getting a message to appear in a label.

I have the following code snippet:

lbErrorMssg.Text = ""
foreach (DataRow Rrow in ds.Tables["ImportCSV"].Rows)
{
string sString = Rrow["EmployeeNumber"].ToString();
if (!ImportCSV.IsNumeric(sString))
{
lbErrorMssg.Text = lbErrorMssg.Text + "EmployeeNumber " + sString +
"is not an integer. Please verify the EmployeeNumber." + "<BR>";
}
}

I know that this is catching non numeric entries because the label is
populated with as many error messages as I put errors in the text
data. However, the text of sString never appears in lbErrorMssg. I
replaced sString with Rrow["EmployeeNumber"].ToString(); but there was
no change. How can I make the value for the invalid EmployeeNumber
appear in the text of lbErrorMessage?

In case you are wondering what is "IsNumeric", it is a custom function
I made to mimic the built in IsNumeric function of vbscript, or isnan
from javascript.

--Terry

Nov 18 '05 #2
Martin,

If I step through the code the locals window displays every
EmployeeNumber value for the line "string sString =
Rrow["EmployeeNumber"].ToString();",
unless the value is not numeric. so I see something like

sString = "597308"
sString = "597309"
sString = "597310"
sString = "597311"

Until I hit a non numeric value such as 59xxxx, and then I see
sString = ""

I do not understand why the value goes to "" at that point. It is not
as if the DataSet is strongly typed. I generate the DataSet with a
simple ODBC query,

string ConnectionString = @"Driver={Microsoft Text Driver (*.txt;
*.csv)};DBQ=c:\";
string sSQL = "SELECT EmployeeNumber, FName, LName, Site FROM " +
FileName;
OdbcConnection conn = new OdbcConnection(ConnectionString);
try
{
conn.Open();
OdbcDataAdapter da = new OdbcDataAdapter(sSQL, conn);
da.Fill(ds,"ImportCSV");
}

It seems like all the fields would default to string so the switch
from a numeric to non numeric value is no problem????

What am I missing?

--Terry
"Martin Dechev" <de*******@hotmail.com> wrote in message news:<eR**************@tk2msftngp13.phx.gbl>...
Hi, Terry,

Did you try to debug the code? What is the value of sString shown in the
debugger? Maybe it is an empty string. Try printing sString.Length.

Hope this helps
Martin
"Terry" <NT********@msn.com> wrote in message
news:55**************************@posting.google.c om...
Howdy,

I'm having trouble getting a message to appear in a label.

I have the following code snippet:

lbErrorMssg.Text = ""
foreach (DataRow Rrow in ds.Tables["ImportCSV"].Rows)
{
string sString = Rrow["EmployeeNumber"].ToString();
if (!ImportCSV.IsNumeric(sString))
{
lbErrorMssg.Text = lbErrorMssg.Text + "EmployeeNumber " + sString +
"is not an integer. Please verify the EmployeeNumber." + "<BR>";
}
}

I know that this is catching non numeric entries because the label is
populated with as many error messages as I put errors in the text
data. However, the text of sString never appears in lbErrorMssg. I
replaced sString with Rrow["EmployeeNumber"].ToString(); but there was
no change. How can I make the value for the invalid EmployeeNumber
appear in the text of lbErrorMessage?

In case you are wondering what is "IsNumeric", it is a custom function
I made to mimic the built in IsNumeric function of vbscript, or isnan
from javascript.

--Terry

Nov 18 '05 #3

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

Similar topics

1
by: eltronic | last post by:
here is some code to add right click context menus. in the few apps I've edited sofar, it just works, once you run rCbinder with the root of the gui or bind B3 all present and future widgets will...
0
by: Adam McCarthy | last post by:
I'm trying to get a cross compiler working for arm-wince-pe. This is the output for the primes Pyrex example. If I compile simple Hello, World's etc, it works fine, but for some reason Python...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
3
by: John Kristensen | last post by:
Hi I'm having a little stupid problem when trying to change properties in a Textbox (or a label) using Event Procedures. Im doing a report and want to change the Control Source in a textbox,...
5
by: John Baro | last post by:
Where is my TabStop property. I want to prevent tabbing to a label. In the MSDN it shows Label.TabStop Property This member supports the .NET Framework infrastructure and is not intended to be...
5
by: unwantedspam | last post by:
Hi All, What am I missing. I have trying to create a simple web based application. Basically there are three textboxes and two buttons (Save, Reset). I assume the code behind the save button...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
4
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.