Click here to Skip to main content
15,907,493 members
Home / Discussions / C#
   

C#

 
AnswerRe: Chess Pin
Luc Pattyn21-Mar-12 14:14
sitebuilderLuc Pattyn21-Mar-12 14:14 
AnswerRe: Chess Pin
Abhinav S21-Mar-12 18:02
Abhinav S21-Mar-12 18:02 
QuestionC# working with excel Pin
sc steinhayse21-Mar-12 6:26
sc steinhayse21-Mar-12 6:26 
AnswerRe: C# working with excel Pin
Ravi Bhavnani21-Mar-12 6:30
professionalRavi Bhavnani21-Mar-12 6:30 
Questionlogging failure using Trace.Listener Pin
Member 842933321-Mar-12 5:12
Member 842933321-Mar-12 5:12 
AnswerRe: logging failure using Trace.Listener Pin
Eddy Vluggen21-Mar-12 6:11
professionalEddy Vluggen21-Mar-12 6:11 
GeneralRe: logging failure using Trace.Listener Pin
Bernhard Hiller21-Mar-12 21:29
Bernhard Hiller21-Mar-12 21:29 
AnswerRe: logging failure using Trace.Listener Pin
Eddy Vluggen22-Mar-12 6:15
professionalEddy Vluggen22-Mar-12 6:15 
GeneralRe: logging failure using Trace.Listener Pin
Member 842933321-Mar-12 23:13
Member 842933321-Mar-12 23:13 
AnswerRe: logging failure using Trace.Listener Pin
Eddy Vluggen22-Mar-12 6:18
professionalEddy Vluggen22-Mar-12 6:18 
QuestionHow can I Implement Virtual tour with C#? Pin
a.fateme21-Mar-12 1:34
a.fateme21-Mar-12 1:34 
AnswerRe: How can I Implement Virtual tour with C#? Pin
Ravi Bhavnani21-Mar-12 2:29
professionalRavi Bhavnani21-Mar-12 2:29 
GeneralRe: How can I Implement Virtual tour with C#? Pin
a.fateme21-Mar-12 6:40
a.fateme21-Mar-12 6:40 
AnswerRe: How can I Implement Virtual tour with C#? Pin
Ravi Bhavnani21-Mar-12 6:56
professionalRavi Bhavnani21-Mar-12 6:56 
GeneralRe: How can I Implement Virtual tour with C#? Pin
a.fateme21-Mar-12 7:29
a.fateme21-Mar-12 7:29 
GeneralRe: How can I Implement Virtual tour with C#? Pin
Ravi Bhavnani21-Mar-12 7:57
professionalRavi Bhavnani21-Mar-12 7:57 
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 

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.