使用 Janus GridEx 控件,Visual C#。我有一个计时器,它通过数据库上的存储函数每 3 分钟更新一次网格。如何双击特定行并将其显示在带有网格中 4 个单元格文本的多行文本框中?
在这里待了 4 天,我要疯了!!!
起始形式:
public DSC_Mon()
{
InitializeComponent();
Caller = new DSCU_SvcConsumer.MTCaller();
dsZA = new DataSet();
dsOut = new DataSet();
this.gridEXMon.DoubleClick += new System.EventHandler(this.gridEXMon_DoubleClick);
}
private void DSC_Mon_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void LoadData()
{
if (!dsZA.Tables.Contains("Query"))
{
DataTable dtZA = dsZA.Tables.Add("Query");
dtZA.Columns.Add("str");
dtZA.Rows.Add(string.Format(@"exec MON_GetStatus"));
}
//dtZA.Rows.Add(string.Format(@"select * from am_company"));
dsOut.Clear();
dsOut.Merge(Caller.CallRequest("ZuluAction", dsZA));
if (gridEXMon.DataSource == null)
{
gridEXMon.DataSource = dsOut;
gridEXMon.DataMember = "Table";
}
//gridEXMon.RetrieveStructure();
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = false;
LoadData();
timer1.Enabled = true;
}
private void gridEXMon_DoubleClick(object sender, EventArgs e)
{
ReportInfo report = new ReportInfo();
report.ShowDialog();
}
}
}
弹出框:
public ReportInfo()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
string value = "System: " + Environment.NewLine + systemNameTextBox.Text + Environment.NewLine +
Environment.NewLine + "Manager: " + Environment.NewLine + contactName1TextBox.Text +
Environment.NewLine + Environment.NewLine + "Function Name: " + Environment.NewLine +
functionNameTextBox.Text;
Clipboard.SetText(value);
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtpaddress");
mail.From = new MailAddress("emailaddress");
mail.To.Add("emailaddress");
mail.Subject = "Test Mail";
mail.Body = value;
SmtpServer.Port = 25;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = false;
SmtpServer.Send(mail);
MessageBox.Show(" Report Information sent to Service Support Group");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}