Click here to Skip to main content
15,898,769 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I Implement Virtual tour with C#? Pin
a.fateme21-Mar-12 8:09
a.fateme21-Mar-12 8:09 
AnswerRe: How can I Implement Virtual tour with C#? Pin
Ravi Bhavnani21-Mar-12 8:15
professionalRavi Bhavnani21-Mar-12 8:15 
GeneralRe: How can I Implement Virtual tour with C#? Pin
a.fateme21-Mar-12 8:25
a.fateme21-Mar-12 8:25 
AnswerRe: How can I Implement Virtual tour with C#? Pin
Ravi Bhavnani21-Mar-12 8:39
professionalRavi Bhavnani21-Mar-12 8:39 
GeneralRe: How can I Implement Virtual tour with C#? Pin
a.fateme21-Mar-12 8:48
a.fateme21-Mar-12 8:48 
AnswerRe: How can I Implement Virtual tour with C#? Pin
Abhinav S21-Mar-12 5:06
Abhinav S21-Mar-12 5:06 
AnswerRe: How can I Implement Virtual tour with C#? Pin
jschell21-Mar-12 9:06
jschell21-Mar-12 9:06 
QuestionValidating textboxes in C# Pin
Xonel20-Mar-12 21:54
Xonel20-Mar-12 21:54 
Hi
This code here below allows only numbers and one decimal point to be typed on a textbox.
It does not prevent you from:
1. Saving nulls in the database
2. From pasting any other character(words, asterisks,numbers etc) to the textbox.
What do i have to add to the code to prevent the two problems from occurring??
Here is my code:
C#
private void txtBalance_TextChanged(object sender, EventArgs e)
{
    txtBalance.KeyPress += new KeyPressEventHandler(numbercheck_KeyPress);
}
private void numbercheck_KeyPress(object sender, KeyPressEventArgs e)
{

    if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
    {
        e.Handled = true;
    }

    //only allow one decimal point
    if (e.KeyChar == '.'
        && (sender as TextBox).Text.IndexOf('.') > -1)
    {
        e.Handled = true;
    }
}


Please help me figure out
Thanks
AnswerRe: Validating textboxes in C# Pin
Not Active20-Mar-12 22:21
mentorNot Active20-Mar-12 22:21 
GeneralRe: Validating textboxes in C# Pin
Xonel20-Mar-12 22:30
Xonel20-Mar-12 22:30 
GeneralRe: Validating textboxes in C# Pin
Not Active20-Mar-12 22:45
mentorNot Active20-Mar-12 22:45 
GeneralRe: Validating textboxes in C# Pin
taha bahraminezhad Jooneghani20-Mar-12 23:14
taha bahraminezhad Jooneghani20-Mar-12 23:14 
GeneralRe: Validating textboxes in C# Pin
Vipin_Arora21-Mar-12 0:54
Vipin_Arora21-Mar-12 0:54 
GeneralRe: Validating textboxes in C# Pin
Vipin_Arora21-Mar-12 1:04
Vipin_Arora21-Mar-12 1:04 
AnswerRe: Validating textboxes in C# Pin
Bernhard Hiller20-Mar-12 22:34
Bernhard Hiller20-Mar-12 22:34 
AnswerRe: Validating textboxes in C# Pin
BobJanova21-Mar-12 3:08
BobJanova21-Mar-12 3:08 
AnswerRe: Validating textboxes in C# Pin
PIEBALDconsult21-Mar-12 3:10
mvePIEBALDconsult21-Mar-12 3:10 
AnswerRe: Validating textboxes in C# Pin
DaveyM6921-Mar-12 3:28
professionalDaveyM6921-Mar-12 3:28 
GeneralRe: Validating textboxes in C# Pin
Xonel21-Mar-12 19:49
Xonel21-Mar-12 19:49 
GeneralRe: Validating textboxes in C# Pin
DaveyM6924-Mar-12 22:36
professionalDaveyM6924-Mar-12 22:36 
QuestionNET Lib to read / change / write MAT (MatLab) files Pin
Rene Sattler20-Mar-12 21:08
Rene Sattler20-Mar-12 21:08 
AnswerRe: NET Lib to read / change / write MAT (MatLab) files Pin
Ravi Bhavnani21-Mar-12 7:00
professionalRavi Bhavnani21-Mar-12 7:00 
GeneralRe: NET Lib to read / change / write MAT (MatLab) files Pin
Rene Sattler21-Mar-12 20:46
Rene Sattler21-Mar-12 20:46 
QuestionClass Diagram in C# 2010 Express? Pin
DRAYKKO77720-Mar-12 14:19
DRAYKKO77720-Mar-12 14:19 
AnswerRe: Class Diagram in C# 2010 Express? Pin
Abhinav S20-Mar-12 16:50
Abhinav S20-Mar-12 16:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.