我有一个带调用函数的ac#代码,例如:
private void cmdCommand_Click(object sender, EventArgs e)
{
m_socClient.Close();
}
Run Code Online (Sandbox Code Playgroud)
但现在我希望在m_socClient.Close();30秒之后调用该函数.那可能吗?
我有一个5(0-5)列的datagridview.我从创建的哈希表中检索的所有行值.现在我设置了一个条件,表明第4列是否包含哈希表中的空值,然后在第4列旁边添加新列,这使得新添加的列索引位于第5位,之前第5列的哈希表值更改为第7列.
我做这样的代码:
int number = dataGridView1.Rows.Add();
dataGridView1.Rows[number].Cells[0].Value = result; //id
dataGridView1.Rows[number].Cells[1].Value = newAddress; //ip
dataGridView1.Rows[number].Cells[2].Value = (string)((Hashtable)ht[1])["value"]; //name
dataGridView1.Rows[number].Cells[3].Value = (string)((Hashtable)ht[2])["value"]; //description
if (!ht.ContainsValue(3))
{
// Create a Save button column
DataGridViewImageButtonSaveColumn columnSave = new DataGridViewImageButtonSaveColumn();
// Set column values
columnSave.Name = "SaveButton";
columnSave.HeaderText = "";
//Add the columns to the grid
dataGridView1.Rows[number].Cells[4].ReadOnly = false;
dataGridView1.Columns[5].Add(columnSave); //im not sure about this codes
dataGridView1.Rows[number].Cells[6].Value = (string)((Hashtable)ht[4])["value"]; //count
}
else
{
dataGridView1.Rows[number].Cells[4].Value = (string)((Hashtable)ht[3])["value"]; //location
dataGridView1.Rows[number].Cells[5].Value = (string)((Hashtable)ht[4])["value"]; //count
}
Run Code Online (Sandbox Code Playgroud)
但是,我不确定我是否正确行事,因为我在评论的行中收到错误
dataGridView1.Columns[5].Add(columnSave); …Run Code Online (Sandbox Code Playgroud) 我有几个标签页集合.默认情况下,当用户打开应用程序时,第一个标签页是开始标签页,然后用户将关闭标签页.现在我想创建一种情况,当用户转到菜单条时,单击"标签页1按钮",然后"标签页1"将出现在标签控件中.任何专业知识都可以帮助我...
我创建了一个toolStripComboBox并从数据库中检索所有项目列表选择,如下所示:
private void toolStripComboBox1_Click(object sender, EventArgs e)
{
toolStripComboBox1.ComboBox.ValueMember = "month";
toolStripComboBox1.ComboBox.DataSource = dbConnect.selectMonth(); //get all month from the database
}
Run Code Online (Sandbox Code Playgroud)
然后组合框显示数据库中的所有月份。
后来我尝试使用selectedItem类似这样的东西从组合框中获取选择:
string monthSelect = toolStripComboBox1.SelectedItem.ToString();
Run Code Online (Sandbox Code Playgroud)
不过我得到了价值monthSelect = "System.Data.DataRowView"
知道如何获取值而不是吗System.Data.DataRowView?
我想加入字符串以显示在消息框中,但不知道为什么我在这一行会收到错误:
IPAddress[] ips = Dns.GetHostAddresses(he.HostName);
var addr = string.Join(",",ips); // the error display invalid argument.
MessageBox.Show(addr);
Run Code Online (Sandbox Code Playgroud)
我知道这听起来很基本.但我是新手,有人能帮帮我吗?
错误:
以下方法或属性之间的调用不明确:'string.Join(string,params object [])'和'string.Join(string,System.Collections.Generic.IEnumerable)'