string - Simple substring program won't work -
My job private: System :: Void textbox 1 tags (System :: Object sender, System :: EventArgs ^ e) { } created and run, my program crashed Please help < Div class = "post-text" itemprop = "text"> First of all it is not C ++, it is C ++ / CLI, which is targeting language extension CLI. Second, I do not know how this is done when you do this code Edit: Notice this code < example code> Argumentotofrenj Aksposn tbUnos is a text input and
label1 string Let's print the first two letters of the letter I have started learning Visual C ++ and I am trying to understand things.
String ^ sUnos = tbUnos - & gt; Text; Label 1- & gt; Text = sUnos-> String :: Substring (1,2);
sUnos-> string :: substrings . However, your code should look like this:
string ^ sUnos = tbUnos-> Text; If (! String :: IsNullOrEmpty (sUnos)) label 1- & gt; Text = sUnos-> Substrings (1,2);
TextChanged is the handler for the event means that you press a key every time the keyboard, such as changing text When you type the first letter in the text box, then
tbUnos-> Text will be a letter and
substring (1, 2) throws because there is no index to start with 1:
startIndex plus
length is not in this position.
Comments
Post a Comment