Hi, I have question.
I make method in Class to take 2 integer argument from textbox as below.
public class TestTake
{
public void TakeArgument(int FirstParam , int SecondParam)
{
MessageBox.Show(" First " + FirstParam + "Second "+SecondParam);
}
}
=== Then in Form1 I put 1 textbox control there to wait for take 2 integer argement. But i don't know how to take those 2 argument.
TestTake t = new TestTake();
textbox1.text = t.TakeArgument(?????);
Help to explain me please....
FoonMod....
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Apr 24, 2011, 8:29 PM EDT
natchaya khamkuna31 reputationPosted Apr 24, 2011, 8:40 PM EDT
I prefer to use 2 textboxes too. I just wonder ,if we would like to take 2 parameter from only 1 textbox. each integer separate by comma (,) . Would it be possible ?..
Sam HobbsRank #107 · 20.5K reputationPosted Apr 24, 2011, 8:50 PM EDT
See Split String in C#.
Mayur GujrathiRank #666 · 3.6K reputationPosted Apr 24, 2011, 9:17 PM EDT
you can do like this afte inserting , between two arguments string s = TextBox1.Text // // Split string on spaces. // ... This will separate all the words. // string[] words = s.Split(,); foreach (string word in words) { Console.WriteLine(word); }Ankit NandekarRank #703 · 3.4K reputationPosted Apr 24, 2011, 9:31 PM EDT
http://www.c-sharpcorner.com/Blogs/4752/split-function-in-C-Sharp.aspx
natchaya khamkuna31 reputationPosted Apr 24, 2011, 9:49 PM EDT
I can do now.