hi,
i have xtraform (to manage Branch ) that contains some inputs and gridview.
after loading the form , i can focus any input
(ex:- CodeInput.Text )without any problems. but when i click
EditGridbtnREP , the inputs filled with the data.
please Note: there are a relation between
ad_branches table and many others tables.
when i focus any inputs again , the form hang , and take 2-3 min. to respond.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraSplashScreen;
using MrSales.MrSLanguages;
using MrSales.MrSModels;
using System.Data.Entity;
using System.Runtime.InteropServices;
namespace MrSales.MrSViews.CompanyConfig
{
public partial class ManageBranches : DevExpress.XtraEditors.XtraForm
{
public int ID = 0;
public ManageBranches()
{
SplashScreenManager.CloseForm(false);
SplashScreenManager.ShowForm(this, typeof(waitForm), true, true, false);
try { SplashScreenManager.Default.SetWaitFormDescription(strings.Creating_basic_components); } catch { }
InitializeComponent();
mrsalesdbEntities dbContext = ConnectionTools.OpenConn();
try{ SplashScreenManager.Default.SetWaitFormDescription(strings.loading_branches_list); } catch { }
ad_branchesBindingSource.DataSource = dbContext.ad_branches.ToList();
try { SplashScreenManager.Default.SetWaitFormDescription(strings.LOADING_company_data); } catch { }
ad_company_dataBindingSource.DataSource = dbContext.ad_company_data.Local.ToBindingList();
try { SplashScreenManager.Default.SetWaitFormDescription(strings.loading_Countries_Cities); } catch { }
ad_countryBindingSource.DataSource = dbContext.ad_country.ToList();
ad_cityBindingSource.DataSource = dbContext.ad_city.ToList();
}
const int HT_CAPTION = 0x2;
const int WM_NCLBUTTONDOWN = 0xA1;
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
private void ManageBranches_Load(object sender, EventArgs e)
{
SplashScreenManager.Default.SetWaitFormDescription(strings.loading_interface);
MrSControls.FormLoad.PublicDesign(this);
CompanyInput.EditValue = 1;
SplashScreenManager.CloseForm(false);
}
private void CloseFrmBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void HeaderPanel_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
private void EditGridbtnREP_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
ID = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_ID"));
CompanyInput.EditValue = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "comp_ID"));
CodeInput.Text = Convert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Code"));
NameInput.Text = Convert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Name"));
StatusToggle.EditValue = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Status")) == 0 ? false : true;
Mobile1Input.Text = Convert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Mobile1"));
Mobile2Input.Text = Convert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Mobile2"));
Mobile3Input.Text = Convert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Mobile3"));
PhoneInput.Text = Convert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Phone"));
AddressInput.Text = Convert.ToString(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "branche_Address"));
CountryInput.EditValue = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Country"));
CityInput.EditValue = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "City"));
}
}
}
What I have tried:
i created new form and copied the controls one by one and the problem still exist
i tried comment the codes one by one but the same issue
SplashScreenManager.CloseForm(false);
SplashScreenManager.ShowForm(this, typeof(waitForm), true, true, false);
try { SplashScreenManager.Default.SetWaitFormDescription(strings.Creating_basic_components); } catch { }
InitializeComponent();
mrsalesdbEntities dbContext = ConnectionTools.OpenConn();
try{ SplashScreenManager.Default.SetWaitFormDescription(strings.loading_branches_list); } catch { }
ad_branchesBindingSource.DataSource = dbContext.ad_branches.ToList();
try { SplashScreenManager.Default.SetWaitFormDescription(strings.LOADING_company_data); } catch { }
ad_company_dataBindingSource.DataSource = dbContext.ad_company_data.Local.ToBindingList();
try { SplashScreenManager.Default.SetWaitFormDescription(strings.loading_Countries_Cities); } catch { }
ad_countryBindingSource.DataSource = dbContext.ad_country.ToList();
ad_cityBindingSource.DataSource = dbContext.ad_city.ToList();