gpt4 book ai didi

c# - 从 GridEX 中的行复制文本

转载 作者:太空宇宙 更新时间:2023-11-03 10:37:57 25 4
gpt4 key购买 nike

使用 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());
}
}
}

最佳答案

需要使用GridEX的RowDoubeClick事件。

这是如何使用它:

private void gridEXMon_RowDoubleClick(object sender, Janus.Windows.GridEX.RowActionEventArgs e)
{
if (e.Row.RowIndex < 0)
return;

int BillID = Convert.ToInt32(e.Row.Cells["Cell1"].Value);
String BillID = Convert.ToString(e.Row.Cells["Cell2"].Value);
Decimal BillID = Convert.ToDecimal(e.Row.Cells["Cell3"].Value);
int BillID = Convert.ToInt32(e.Row.Cells["Cell4"].Value);

ReportInfo report = new ReportInfo();
// Here you need to pass the 4 cell values to your Pop up Dialog
report.ShowDialog();
}

关于c# - 从 GridEX 中的行复制文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26808227/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com