Click here to Skip to main content
16,016,736 members
Home / Discussions / C#
   

C#

 
AnswerRe: can anyone suggest best books or links for C# interview Pin
Amarnath S23-Nov-15 2:43
professionalAmarnath S23-Nov-15 2:43 
AnswerRe: can anyone suggest best books or links for C# interview Pin
Rob Philpott23-Nov-15 4:48
Rob Philpott23-Nov-15 4:48 
GeneralRe: can anyone suggest best books or links for C# interview Pin
Mycroft Holmes23-Nov-15 13:11
professionalMycroft Holmes23-Nov-15 13:11 
GeneralRe: can anyone suggest best books or links for C# interview Pin
OriginalGriff23-Nov-15 22:23
mveOriginalGriff23-Nov-15 22:23 
GeneralRe: can anyone suggest best books or links for C# interview Pin
Rob Philpott23-Nov-15 23:54
Rob Philpott23-Nov-15 23:54 
GeneralRe: can anyone suggest best books or links for C# interview Pin
Pete O'Hanlon24-Nov-15 0:05
mvePete O'Hanlon24-Nov-15 0:05 
AnswerRe: can anyone suggest best books or links for C# interview Pin
Gerry Schmitz23-Nov-15 7:01
mveGerry Schmitz23-Nov-15 7:01 
QuestionHow to set TextBox to only accept numbers? Pin
naouf1021-Nov-15 7:34
naouf1021-Nov-15 7:34 
I have already checked other questions here but the answers are not related to my issue. the following code allows textbox1 to only accept numbers if the physical keyboard (laptop) is pressed:

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
char ch = e.KeyChar;
if ( !char.IsDigit(ch))
{

e.Handled = true;
}
}

but this is not what I wanted (I dont use physical laptop keyboard).


I have windows form with buttons and a textbox1. I designed keyboard and it works well but I want textbox1 to only accept numbers and the ".".

There are only two lines of code inside each button (and only code in the project) which is:

private void buttonName_Click(object sender, EventArgs e)
{
// each button only has this code.

textBox1.Focus();
SendKeys.Send(buttonName.Text);
}

I know how to set textbox to accept numbers if the physical (laptop ) keys are pressed but here in this case I have windows form with control buttons ( each button to print its text into textbox1) and I want to set textBox1 to only accept numbers and the ".". Please help in how to achieve this. Thank you
AnswerRe: How to set TextBox to only accept numbers? Pin
Gerry Schmitz21-Nov-15 11:38
mveGerry Schmitz21-Nov-15 11:38 
AnswerRe: How to set TextBox to only accept numbers? Pin
Gilbert Consellado21-Nov-15 16:25
professionalGilbert Consellado21-Nov-15 16:25 
AnswerRe: How to set TextBox to only accept numbers? Pin
BillWoodruff21-Nov-15 18:43
professionalBillWoodruff21-Nov-15 18:43 
QuestionHow to replace text in this situation? Pin
turbosupramk320-Nov-15 7:24
turbosupramk320-Nov-15 7:24 
AnswerRe: How to replace text in this situation? Pin
Gerry Schmitz20-Nov-15 8:07
mveGerry Schmitz20-Nov-15 8:07 
AnswerRe: How to replace text in this situation? Pin
Matt T Heffron20-Nov-15 8:47
professionalMatt T Heffron20-Nov-15 8:47 
QuestionGet row from AngleSharp.Dom.Html.HtmlSpanElement Pin
Member 1215521920-Nov-15 1:12
Member 1215521920-Nov-15 1:12 
AnswerRe: Get row from AngleSharp.Dom.Html.HtmlSpanElement Pin
Gerry Schmitz20-Nov-15 5:09
mveGerry Schmitz20-Nov-15 5:09 
QuestionGetting ASCII value for Characters? Pin
murali_utr19-Nov-15 22:15
murali_utr19-Nov-15 22:15 
AnswerRe: Getting ASCII value for Characters? Pin
BillWoodruff19-Nov-15 22:49
professionalBillWoodruff19-Nov-15 22:49 
GeneralRe: Getting ASCII value for Characters? Pin
murali_utr20-Nov-15 1:33
murali_utr20-Nov-15 1:33 
GeneralRe: Getting ASCII value for Characters? Pin
Member 1215521920-Nov-15 1:46
Member 1215521920-Nov-15 1:46 
GeneralRe: Getting ASCII value for Characters? Pin
murali_utr20-Nov-15 2:38
murali_utr20-Nov-15 2:38 
GeneralRe: Getting ASCII value for Characters? Pin
Richard MacCutchan20-Nov-15 3:07
mveRichard MacCutchan20-Nov-15 3:07 
GeneralRe: Getting ASCII value for Characters? Pin
OriginalGriff20-Nov-15 2:49
mveOriginalGriff20-Nov-15 2:49 
AnswerRe: Getting ASCII value for Characters? Pin
Richard MacCutchan19-Nov-15 23:20
mveRichard MacCutchan19-Nov-15 23:20 
QuestionLeap Motion Integration problem Pin
Alpa2419-Nov-15 14:44
Alpa2419-Nov-15 14:44 

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.