I tried to split a String into a parts array and combine them at the end into a result String. But while I tested a little bit, I get a message.
By pressing convert_click:
"NullRefenceException was unhandeled"
Object reference not set to an instance of an object.
Here the main code:
public string []parts { get; set; }
public string inputStr { get; set; }
private void inputText_TextChanged(object sender, EventArgs e)
{
String inputStr = inputText.ToString();
//example
//inputStr = "984, fenceshit2, 0, 1994.56025813, -1592.16428141, 16.105, 0.653280779782, 0.270598520636, 0.653281646552, 0.270598879665, -1";
}
private void convert_Click(object sender, EventArgs e)
{
String creObj = "CreateObject(";
String result;
String[] parts = inputStr.Split(new char[] { ',' });
result = creObj +
parts[0] + "," +
parts[2] + "," +
parts[3] + "," +
//...up to "parts[10"
");";
outputText.Text = result;
//output(should be in this case):
//"CreateObject(984, 1994.56025813, -1592.16428141, 16.105, 0.653280779782, 0.270598520636, 0.653281646552, 0.270598879665, -1);"
}
//If I need to creat a code line in the main Designer.cs, please let me know.
I just want to split a String and combine them in the end into 1 string and send this into a text box.
If someone wants the sourcecode, pm me.
Console.WriteLine(inputStr)
output?