积极答复者
VS2005 控件不全?

问题
答案
全部回复
-
谢谢你们!
我在tabcontrol里面放了个textBox1和button1
然后在button1的click事件里 使用textBox1.Text
代码如下:
private void button1_Click(Object sender, System.EventArgs e)
{//openFileDialog1.ShowDialog(); //打开文件对话框
OpenFileDialog fbd = new OpenFileDialog();
DialogResult dr = fbd.ShowDialog();
if (dr == DialogResult.OK)
{
this.textBox1.Text = fbd.SelectedFilePath;
}提示错误:错误 1 在类型“System.Windows.Forms.TextBox”中无法找到字段“Text”
private void saveAnalyzeAsToolStripMenuItem_Click(Object sender, System.EventArgs e)
{
SaveFileDialog sf = new SaveFileDialog();
sf.Filter = "ACCESS 2003(*.mdb)|*.mdb|所有文件|*.*"; //文件类型
sf.Title = "数据库另存为";
}
也提示 找不到 “Filter”、“Title ”
能不能加一下小弟的QQ,等回帖很着急~ -
kenny.xie 写: 谢谢周雪峰。
有没有人遇到过类似情况或者有不同见解。
现在可以确定跟VS2005安装没关系,因为我新建了另一个项目,textBox的Text属性可以用。这样,看来就是我的程序的问题了。
但是看不出在哪犯了错误。
有谁有不同见解?谢谢!
我刚刚建了个window form项目,就拖出了button和textBox 两个控件,Text属性不可用...
全部代码如下,望热心人指点啊!
package test;
import System.Collections.Generic.*;
import System.Data.*;
import System.Drawing.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;/**
* Form1 的摘要说明。
*/
public class Form1 extends System.Windows.Forms.Form
{
private Button button1;
private TextBox textBox1;
/**
* 必需的设计器变量。
*/
private System.ComponentModel.IContainer components;public Form1()
{
//
// Windows Form 设计器支持所必需的
//
InitializeComponent();//
// TODO: 在 InitializeComponent 调用之后添加任何构造函数代码
//
}#region Windows 窗体设计器生成的代码
/**
* 清理所有正在使用的资源。
*/
protected void Dispose(boolean disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}/**
* 设计器支持所需的方法 - 不要
* 使用代码编辑器修改此方法的内容。
*/
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
//
this.button1.set_Location(new System.Drawing.Point(276, 266));
this.button1.set_Name("button1");
this.button1.set_Size(new System.Drawing.Size(75, 23));
this.button1.set_TabIndex(0);
this.button1.set_Text("button1");
this.button1.set_UseVisualStyleBackColor(true);
this.button1.add_Click(new System.EventHandler(this.button1_Click));
//
// textBox1
//
this.textBox1.set_Location(new System.Drawing.Point(449, 267));
this.textBox1.set_Name("textBox1");
this.textBox1.set_Size(new System.Drawing.Size(100, 21));
this.textBox1.set_TabIndex(1);
//
// Form1
//
this.set_AutoScaleDimensions(new System.Drawing.SizeF(6F, 12F));
this.set_AutoScaleMode(System.Windows.Forms.AutoScaleMode.Font);
this.set_ClientSize(new System.Drawing.Size(720, 457));
this.get_Controls().Add(this.textBox1);
this.get_Controls().Add(this.button1);
this.set_Name("Form1");
this.set_Text("Form1");
this.ResumeLayout(false);
this.PerformLayout();}
#endregionprivate void button1_Click(Object sender, System.EventArgs e)
{
textBox1.Text = "ll";
}
}在线等在线等...