System.Windows.Controls.TextBox dynamicTextBox = new System.Windows.Controls.TextBox();
//Here Filter the Name from project Table which DbActive state is zero
projectsTable.AddFilter(new Filter(ProjectsColumnTypes.DbActive, CompareOperator.Equals, true));
projectsTable.Read();
UpdateRow.Name = dynamicTextBox.Text;
UpdateRow.DbActive = true;
string previousvalue;
private void items_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
//Get the index value of selected Item
var index = lstbxindex.Items.IndexOf(lstbxindex.SelectedItem);
{
//Get the index value of selected Item
var index = lstbxindex.Items.IndexOf(lstbxindex.SelectedItem);
dynamicTextBox.Width = 230;
dynamicTextBox.Height = 50;
this.lstbxindex.Items.Add(dynamicTextBox);
dynamicTextBox.Text = lstbxindex.SelectedItem.ToString();
previousvalue = dynamicTextBox.Text;
lstbxindex.Items.RemoveAt(index);
// lstbxindex.SelectedItem = dynamicTextBox.Text;
dynamicTextBox.Focus();
dynamicTextBox.AcceptsReturn = true;
}
dynamicTextBox.Height = 50;
this.lstbxindex.Items.Add(dynamicTextBox);
dynamicTextBox.Text = lstbxindex.SelectedItem.ToString();
previousvalue = dynamicTextBox.Text;
lstbxindex.Items.RemoveAt(index);
// lstbxindex.SelectedItem = dynamicTextBox.Text;
dynamicTextBox.Focus();
dynamicTextBox.AcceptsReturn = true;
}
private void checkenterclicked(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
EnterClicked(sender, e);
//dynamicTextBox.PreviewKeyDown += EnterClicked;
}
}
{
if (e.KeyCode == Keys.Enter)
{
EnterClicked(sender, e);
//dynamicTextBox.PreviewKeyDown += EnterClicked;
}
}
private void EnterClicked(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
using (DatabaseConnector databaseConnection = new DatabaseConnector(ApplicationConstants.ConnectionString))
using (ProjectsTable projectsTable = new ProjectsTable(databaseConnection))
{
{
if (e.KeyCode == Keys.Enter)
{
using (DatabaseConnector databaseConnection = new DatabaseConnector(ApplicationConstants.ConnectionString))
using (ProjectsTable projectsTable = new ProjectsTable(databaseConnection))
{
//Here Filter the Name from project Table which DbActive state is zero
projectsTable.AddFilter(new Filter
projectsTable.Read();
projectsTable.AddFilter(new Filter(ProjectsColumnTypes.Name, CompareOperator.Equals, dynamicTextBox.Text));
projectsTable.Read();
foreach (DtoProjectsRow row in projectsTable.Rows)
{
//Guid DbId = row.DbId;
Guid DbId = row.DbId;
{
//Guid DbId = row.DbId;
Guid DbId = row.DbId;
var UpdateRow = projectsTable.NewRow();
UpdateRow.Name = dynamicTextBox.Text;
UpdateRow.DbId = DbId;
UpdateRow.DbActive = true;
// Alter the row to the table.
projectsTable.AlterRow(UpdateRow);
projectsTable.AlterRow(UpdateRow);
// Write the new row to the database.
projectsTable.Post();
projectsTable.Post();
//Add the items in comboBox
lstbxindex.Items.Add(dynamicTextBox.Text);
}
// dynamicTextBox = e.Source as System.Windows.Controls.TextBox;
lstbxindex.Items.Add(dynamicTextBox.Text);
}
// dynamicTextBox = e.Source as System.Windows.Controls.TextBox;
}
}
else
{
if (e.KeyCode == Keys.Escape)
{
lstbxindex.Items.Add(previousvalue);
lstbxindex.Items.Remove(dynamicTextBox);
}
}
}
}
else
{
if (e.KeyCode == Keys.Escape)
{
lstbxindex.Items.Add(previousvalue);
lstbxindex.Items.Remove(dynamicTextBox);
}
}
}
Inside the listbox,if double click the listbox items, the values of the listbox items assign to the dynamic textbox within the listbox.(I created a dynamictextbox withint the listbox).Then I need to modify the textbox values.After that click enter key, the textbox values Added to the listbox items then dynamictextbox removed.when click the esc key the initial values added to listbox item.
I have problem in inside the MouseEventArg method how can call the keyeventArgs method
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Asish MohapatraPosted Feb 2, 2017, 1:20 PM
Amit GuptaPosted Feb 2, 2017, 4:42 AM