p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 26th, 2007, 05:45 AM
Authorized User
 
Join Date: Jun 2007
Location: Pune, Maharastra, India.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling method in windows forms from text control

HI,

How can i call a method to validate atext box in windows forms?
I have currently written as
this.txtmno.LostFocus=Validate(txtmno.Text);
but its displaying error as the event "System.Windows.Form.Control.LostFocus should be on leftside of the =+-.
what may be possible solution to this.

Thanks

Prasnana
__________________
Thanks

Prasanna
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old July 26th, 2007, 07:16 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Firstly you have posted it in wrong subforum.
Secondly LostFocus is an event and you have wrongly tried to set value.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old July 26th, 2007, 11:43 PM
vbn vbn is offline
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

18. Validating the data entered in the Amount TextBox control.

This event occurs when the input focus leaves the control. This event procedure is to check for whether data entered in amount text box control is valid.  

Private Sub mAmount_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles mAmount.LostFocus
    If Not IsNumeric(mAmount.Text) And mAmount.Text <> " " Then
        MsgBox("Not a Numeric Input! Try again.")
        mAmount.Focus()
        Exit Sub
    ElseIf (mAmount.Text < 0) Then
        MessageBox.Show("Enter positive Amount")
        mAmount.Focus()
        Exit Sub
    End If
End Sub


The TextChanged event occurs when the content in the TextBox control is changed. Select mAmount in LHS combobox and TextChanged in the RHS combobox to program this event. We use IsNumeric() function  to check the value  entered in the amount text box control is numeric data. We also check whether the value entered in this text box is empty.  If any of these conditions are true, then we will display a message box and set the focus to the Amount text box control.
 
Private Sub mAmount_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mAmount.TextChanged
    If Not IsNumeric(mAmount.Text) And mAmount.Text <> " " Then
        MsgBox("Not a Numeric Input! Try again.")
        mAmount.Focus()
        Exit Sub
    End If
End Sub


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a btn_click method dhirajDac ASP.NET 2.0 Professional 2 April 18th, 2008 08:52 AM
Calling a function on every method call Takashi321 General .NET 1 September 21st, 2007 10:33 AM
Calling a method from Linkbutton in DataList swifty_programmer ASP.NET 2.0 Basics 1 July 28th, 2007 06:32 AM
Error calling a method in the webservice madhusrp .NET Web Services 1 April 12th, 2007 09:54 AM
Wizard control in Windows Forms? wakeup Pro Visual Basic 2005 0 May 15th, 2006 11:35 AM



All times are GMT -4. The time now is 05:05 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc