- Home /
Get value from string and pass it to another field
Hello all,
So I need your help to get a value from a string and put it on other field. I saw tons of exemples around, but I have several issues.
So I have a field named "Comments". I need to check if that field has some words on it. After find one of those words, I need to get the value after that word and pass it to another field named "Selo".
So far I have this code:
private string selos;
public string Selos
{
get { return selos; }
set
{
string[] stringToCheck = new string[] { "Selo:", "selo:", "Selos:", "selos:" };
string[] result;
if(string.IsNullOrEmpty(Comments) == true)
{
SetPropertyValue("Selos", ref selos, "None");
}
else
{
result = Comments.Split(stringToCheck, StringSplitOptions.RemoveEmptyEntries);
SetPropertyValue("Selos", ref selos, result[0]);
}
}
}
Issue 1: I filled the fields "Comments" but in VisualStudio - Watch, this field is allways null, so everything else is null. Issue 2: When I change the "Comments" data, the VS Watch recognizes changes and passes all the data in this field to the "Selos" field, which is not what I want. I just want data after stringToCheck...
Here's an exemple:
Comments: Everythings OK. Selo: Q457896; Q457897
Now, the code puts in "Selo" field: Everythings OK. Selo: Q457896; Q457897, however, it doesn't save this value in the database. What I really want is:
Field Selo - Q457896; Q457897
Please I need your help to get this working... What am I missing/doing wrong here?
Thanks
Your answer
