c# - how to add a row in a datagridview via other form using C#
问题描述
I'm stuck in a problem in windown form (C#). I have MainUI form consist of a DataGridView, that contains data in my database and a button called BtnRegister. And I have Register form containing some TextBoxs, CheckBoxs... and a confirm button. When I click BtnRegister, Register form is shown and I can input data by typing in textboxs, ... and confirm data inputed by clicking confirm button. The problem is that I dont known how to add a new row into DataGridView in MainUI form by clicking confirm button in Register form. enter image description here
Sorry, my English is not good. But I have a significant hope that some one can help to solve this problem. Thank you.
解决方案
只需观察主窗体中的对话框结果即可。例如:
If (register.ShowDialog() == DialogResult.OK)
{
dataGridView.Add();
// do something
}
推荐阅读
- php - $request->get() 时 laravel + 字符丢失
- sql - WHERE 子句中的 SQLite 计算列似乎正在工作(?)
- unity3d - Unity3D 零件运动
- python - Python如何将列表返回给其他函数?
- javascript - 如何使用节点 js 将字符串路径转换为 JSON 父子树?
- curl - 使用 mingw64 编译静态 cURL 时对 difftime64 的未定义引用
- arduino - ESP8266 WiFiUDP 发送数据包导致挂起然后崩溃
- angular - 通过表单控件从父级获取验证器
- stackexchange-api - SEDE 中的结果计数与 Stack Exchange 的 API 不匹配
- python - 如何在不结束python中的for循环的情况下使用return?