sorry for my bad english . my qustion is (i didnt fien answer on net at all)
how can i hightlight some text from a textbox , use it for some action , and then when i "flip" to next data , i use the new selected text for the same action .
Example from my WinApp : I am coding a WinApp the read some data base , takes all the info and store it on a 'List ' then i start flip pages via button (next) , and every time i do it i want the app to highlight the text in Textbox3 and sendkey "ALT+Q" for triger some action the i have already built .
i already did the program but i have one problim , when a "flip" fot the next "customer" info page , the program highlights its phone number , and SendKeys "ALT+Q" ... BUT! when it trigers the acction , it excecute the commands for the first number WinAPP selects on the start of the program . some help pleas ? i will post my FORM CLASS (small coding )
Form Load:
private void Empcalls_Load(object sender, EventArgs e)
{
OpenFileDialog OpenFile = new OpenFileDialog();
if (OpenFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
MainDB = new DataTable();
Dbop = new Classes.DbConnection();
rList = new List<int>();
int num = 0;
Random ran = new Random();
string filepath = OpenFile.FileName;
MainDB = Dbop.CustomerData(filepath);
for (int i = 0; i < MainDB.Rows.Count-1; i++)
{
do { num = ran.Next(0, (MainDB.Rows.Count-1)); } while (rList.Contains(num));
rList.Add(num);
}
textBox1.Text = MainDB.Rows[rList[mainindex]]["שם name"].ToString();
textBox2.Text = MainDB.Rows[rList[mainindex]]["שם lastName"].ToString();
if (MainDB.Rows[rList[mainindex]]["phone"].ToString().Replace("-", "")=="")
textBox3.Text = MainDB.Rows[rList[mainindex]]["phone2"].ToString().Replace("-", "");
else
textBox3.Text = MainDB.Rows[rList[mainindex]]["טלפון נייד"].ToString().Replace("-","");
currNum = textBox3.Text;
mainindex++;
System.Threading.Thread.Sleep(1000);
textBox3.SelectAll();
SendKeys.Send("%(q)");
}
}
Next Btn:
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = MainDB.Rows[rList[mainindex]]["name"].ToString();
textBox2.Text = MainDB.Rows[rList[mainindex]]["lastName"].ToString();
if (MainDB.Rows[rList[mainindex]]["pone"].ToString().Replace("-", "") == "")
textBox3.Text = MainDB.Rows[rList[mainindex]]["phone"].ToString().Replace("-", "");
else
textBox3.Text = MainDB.Rows[rList[mainindex]]["טלפון phone2"].ToString().Replace("-", "");
textBox3.Focus();
currNum = textBox3.Text;
if (mainindex >= rList.Count-1)
mainindex = 0;
else
mainindex++;
textBox3.SelectAll();
System.Threading.Thread.Sleep(1000);
textBox3.SelectAll();
SendKeys.Send("%(q)");
Clipboard.Clear();
}
** every time i hit 'Next' even the program highlight new textbox3 value , when i send the 'ALT + q' the acctoine accure on the first Highlighted info it dosnt change .
thanx