I found the reason of the current problem.
mainForm = new RadTabbedForm1(Type, Number);
You created a new instance of MainForm in SearchForm, so there are three forms currently.
MainForm => SrarchForm =>MainForm
It's just that you didn't call the Show() method when you created the MainForm, so we couldn't see the third one.
The code you wrote in MainForm to query the database and modify the textBox value will only be executed in the third form (the second mainForm), and what we see is the first mainForm.
So, in any case, the value of textBox in this mainForm will not change.
Try to set Number and Type as Property in SearchForm, and then call it in MainForm.
MainForm:
public Int64 NUMNER { get; set; }
public string TYPE { get; set; }
Pations pation;
public async void _Load(string typ, Int64 num)
{
var result = Task<Pations>.Run(() =>
{
Pations p = Loadpations(typ, num);
return p;
});
Pations PationsResult = await result;
}
private Pations Loadpations(string typ, Int64 num)
{
// ......
this.Invoke((MethodInvoker)delegate ()
{
textBox1.Text = pation.LastName;
});
return pation;
}
private void button1_Click(object sender, EventArgs e)
{
textBox2.Text = "tesst";
using (SearchForm searchForm = new SearchForm())
{
searchForm.ShowDialog();
NUMNER = searchForm.Number;
TYPE = searchForm.Type;
}
_Load(TYPE, NUMNER);
}
SearchForm:
public Int64 Number { get; set; }
public string Type { get; set; }
private void button1_Click(object sender, EventArgs e)
{
RadTabbedForm1 mainForm;
Number = Convert.ToInt64(textBox1.Text);
if (checkedListBox1.CheckedItems.Count>0)
{
if (checkedListBox1.GetItemChecked(0)==true)
{
Type = "Phone";
this.Close();
}
else if (checkedListBox1.GetItemChecked(1) == true)
{
Type = "Code";
this.Close();
}
}
else
{
MessageBox.Show("error");
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.