|
-
Jul 20th, 2007, 01:45 PM
#1
Thread Starter
PowerPoster
[RESOLVED] (2005)Having problems from the start
In an attempt to learn C#.NET, I took an existing (very small) application and decided to rewrite it.
The VB code looks like this (on text changed event):
if Trim(txtunits.text) <> "" then
.....If Not isnumeric(txtunits.text) then
.........Msgbox("Units must be numeric", msgboxstyle.exclamation)
.........txtunits.setfocus
.....endif
endif
It works fine. If they try to enter a non-numeric character they get an error message.
Now, in C#, I have this so far:
private void txtUnits_TextChanged(object sender, EventArgs e)
{
.....if (txtUnits.text != "")
..........if (!isnumeric(txtUnits.Text))
..........{
...............MessageBox.Show("Units must be numeric", "TVAL", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
...............txtUnits.Focus;
..........}
}
I am getting these errors (error 3 refers to the set focus command)
Error 1 'System.Windows.Forms.TextBox' does not contain a definition for 'text' I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 25 25 TVAL
Error 2 The name 'isnumeric' does not exist in the current context I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 26 22 TVAL
Error 3 Only assignment, call, increment, decrement, and new object expressions can be used as a statement I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 29 21 TVAL
Can someone give me a start? I use code as templates. So, once this is figured out, I can propogate it over my project. I have a few manuals and tutorials, but none seem to address this specifically.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|