社区
C#
帖子详情
急!!我是新手,望各位大哥回答!
lovepei99
2004-12-21 07:21:52
在一个WINDOWS应用程序中
放置 一个COMBOBOX控件,和一个DATAGRID
希望在FORM_LOAD事件中先绑定COMBOBOX,
然后在COMBOBOX中有一个SelectedIndexChanged 事件
希望在COMBOBOX里选择一个直之后能在DATAGRID中显示出符合所选值的几列数据
哪位大哥告诉我啊~~~~~不胜感激!!
...全文
151
7
打赏
收藏
急!!我是新手,望各位大哥回答!
在一个WINDOWS应用程序中 放置 一个COMBOBOX控件,和一个DATAGRID 希望在FORM_LOAD事件中先绑定COMBOBOX, 然后在COMBOBOX中有一个SelectedIndexChanged 事件 希望在COMBOBOX里选择一个直之后能在DATAGRID中显示出符合所选值的几列数据 哪位大哥告诉我啊~~~~~不胜感激!!
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lovepei99
2004-12-21
打赏
举报
回复
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OracleClient;
namespace WindowsApplication1
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private string ConString="Data Source=oradb1;User Id=htl_manager;Password=111;";
private DataSet ruzhuDs;
private OracleConnection ruzhuConn ;
private OracleDataAdapter ruzhuDa;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(144, 248);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(392, 80);
this.dataGrid1.TabIndex = 0;
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(144, 80);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 20);
this.comboBox1.TabIndex = 1;
this.comboBox1.Text = "comboBox1";
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(144, 128);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(112, 21);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "textBox1";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(384, 144);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 3;
this.textBox2.Text = "textBox2";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(144, 192);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 4;
this.textBox3.Text = "textBox3";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(408, 176);
this.textBox4.Name = "textBox4";
this.textBox4.TabIndex = 5;
this.textBox4.Text = "textBox4";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(616, 445);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.dataGrid1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
//BindCombobox();
ruzhuConn= new OracleConnection(ConString);
string strSql="select * from room_lev_table ";
ruzhuDs= new DataSet("room_lev_table");
//DataSet ds=new DataSet("room_table");
//OracleDataAdapter da=new OracleDataAdapter(strSql,cn);
ruzhuDa = new OracleDataAdapter(strSql,ruzhuConn);
ruzhuDa.Fill(ruzhuDs,"room_lev_table");
comboBox1.DataSource=ruzhuDs.Tables["room_lev_table"];
comboBox1.DisplayMember = ruzhuDs.Tables ["room_lev_table"].Columns[1].ColumnName;
comboBox1.ValueMember = ruzhuDs.Tables["room_lev_table"].Columns[0].ColumnName;
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
ruzhuConn= new OracleConnection(ConString);
string strSql="select * from room_table where room_num='"+comboBox1.SelectedValue+"'";
ruzhuDs=new DataSet("room_table");
ruzhuDa=new OracleDataAdapter(strSql,ruzhuConn);
ruzhuDa.Fill(ruzhuDs);
dataGrid1.DataSource = ruzhuDs;
dataGrid1.DataMember ="room_table";
}
各位大哥帮忙看看啊!
Alden
2004-12-21
打赏
举报
回复
应该很简单的,你好好检查检查代码,或者把代码贴出来。
hanyaocsdn
2004-12-21
打赏
举报
回复
up
Ivony
2004-12-21
打赏
举报
回复
据你所说,最有可能就是你的cs文件里面的控件的名字(如DataGrid)与你的aspx文件里面的标签(如<asp:DataGrid.....>)的ID属性不匹配。
lovepei99
2004-12-21
打赏
举报
回复
我每次运行都会出现 “未将对象引用设置到对象的实例”?
这是什么意思啊
怎么解决~
急!
lovepei99
2004-12-21
打赏
举报
回复
InterMa(因特马) 大哥 ,帮帮忙啊 !
InterMa
2004-12-21
打赏
举报
回复
这个。。。。。。。。
你都说的相当明白了,没什么难点阿,怎么不会编呢?
张
大哥
笔记:我付钱了,我就是大爷?
然后又挨到第二天,又是东拉西扯的一堆问题,好不容易切入到主题开始远程安装,操作到一半,他自顾自的玩起来,也不顾及我这边的操作了,然后就是各种抱怨,这咋了,那咋了,其实都是一些简单的电脑常识问题,然后又要求你全部给他弄好,因为是个合集,弄好至少需要2个小时,而实际情况就是默认安装2个,其他软件是由客户自己看视频安装的,因为都有详细的操作教程,可是他不依不饶要让你全部给他弄好,然后我拗不过,就说返一半的钱,想的就是尽快脱身!你觉得难、不会的东西,一定不要躲,先搞明白,后精湛,你就比别人优秀了。
题解 | #某乎问答单日
回答
问题数大于等于3个的所有用户#
最近开始找工作刷牛客才发现自己跟大家了解的差多了 :毁约黑榜公司,wlb,offershow,还有一。长安计算机本,一战985失败,调剂陕师大电子信息,现在手中有东风日产offer挺喜欢的,不知道该怎么。发现根本投不进去了,八股文看的时候头头是道,问起来就说的结结巴巴,无奈只能边投边继续复盘......从3月开始准备,到3月底投递,没想到就仅仅只是20多天的差距,导致第一波过饱和,后面就是陷入笔试泡池。面试的时候明明聊得很好,八股百分之90都答上来了,手写出了点问题最后也debug出来了,还是被挂。
面试问到 Handler,这样
回答
让面试官
大哥
心服口服
主要说一下Handler的作用,使用,源码分析,工作原理。Handler的作用:当我们需要在子线程处理耗时的操作(例如访问网络,数据库的操作),而当耗时的操作完成后,需要更新UI,这就需要使用Handler来处理,因为子线程不能做更新UI的操作。Handler能帮我们很容易的把任务(在子线程处理)切换回它所在的线程。简单理解,Handler就是解决线程和线程之间的通信的。Handler的使用:使用...
张
大哥
笔记:录制软件安装视频教程,月入2万
刚开始前半个月,搞的有点被动,因为刚开始做,很多东西不太懂,客户问的问题好多不会
回答
,我就偷偷的找小号去问同行怎么解决的,然后把解决问题的话术放到我的旺旺快捷短语里面,然后慢慢积累经验,越来越熟练,在半个月前,我一直都是用的之前那个教程去交付的,然后我发现教程有很多可以改进的地方,于是我就喊上了我哥们,让他帮我找找源码,我通过他的建议自己模仿做了一个网站来交付,大体上也是模仿他的,只不过我把一些没用的东西删除了,然后换上了让用户下载软件不限速的网盘链接,这一招很管用,客户满意度持续提升!
怎样
回答
离职原因
HR问你上一份工作是因为什么离职的,你怎么
回答
?这是大家都非常在意的一个问题,无论是面试官还是求职者。因为对面试官来说,这意味着能不能给出Offer的问题,而对求职者而言,这意味着能不能顺利拿到Offer的问题。那么我们到底该如何
回答
这个问题呢?来看大家的答案!在
回答
这个问题前,我们先看几个代表性的求职者离职的真正原因:离职原因一:老板的问题(不重视设计/没素质没审美/没诚信)@魏琴:老板很奇葩,...
C#
111,128
社区成员
642,536
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章