请教:如何动态绑定TextBox的TextMode,我用TextBox1.TextMode ="MultiLine"提示出错!

jijiqimao 2003-10-16 08:56:33
D:\01as_web\edu\7.aspx.cs(25): 无法将类型“string”隐式转换为“System.Web.UI.WebControls.TextBoxMode”
...全文
56 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2003-10-16
  • 打赏
  • 举报
回复

TextBox1.TextMode = TextBoxMode.MultiLine
无线条码打印机源代码: private System.Windows.Forms.TextBox InputTextBox; private System.Windows.Forms.Label label1; private SerialAPI.SerialPort Serial=new SerialAPI.SerialPort(); private System.Windows.Forms.OpenFileDialog openFileDialog1; private Microsoft.WindowsCE.Forms.InputPanel inputPanel1; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.Button ConfigeButton; public string BluetoothComPort="COM8:"; public string IRComPort="COM3:"; public string ComPort="Bluetooth"; private System.Windows.Forms.Button PrintButton; private System.Windows.Forms.Button OpenFileButton; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; public string Port; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// /// 清理所有正在使用的资源。 /// protected override void Dispose( bool disposing ) { base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.InputTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.PrintButton = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.OpenFileButton = new System.Windows.Forms.Button(); this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel(); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.ConfigeButton = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); // // InputTextBox // this.InputTextBox.Location = new System.Drawing.Point(8, 24); this.InputTextBox.Multiline = true; this.InputTextBox.Size = new System.Drawing.Size(224, 176); this.InputTextBox.Text = "  VMP01 PLUS便携式微型打印机是VMP01系列微型打印机的升级版,除了具有VMP01系列微型打印机同样出色的性能外,在打印质量以及使用方便性上有了提升," + "该微型打印机采用32位ARM CPU作为中央处理器及先进的富士通打印机芯,大大提高了打印速度。为了避免各种票据打印中频繁出现的生僻字(特别是人名),采用了包含2" + "万多汉字的大容量GBK字库。该微型打印机广泛应用在物流、交警、邮政、城管、烟草、抄表等等领域。\r\n\r\n\r\n"; // // label1 // this.label1.Location = new System.Drawing.Point(88, 8); this.label1.Size = new System.Drawing.Size(56, 16); this.label1.Text = "打印内容"; // // PrintButton // this.PrintButton.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); this.PrintButton.Location = new System.Drawing.Point(8, 208); this.PrintButton.Size = new System.Drawing.Size(56, 22); this.PrintButton.Text = "打印"; this.PrintButton.Click += new System.EventHandler(this.PrintButton_Click); // // openFileDialog1 // this.openFileDialog1.FileName = "发送文件"; this.openFileDialog1.Filter = "文本文件|*.txt"; // // OpenFileButton // this.OpenFileButton.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular); this.OpenFileButton.Location = new System.Drawing.Point(168, 208); this.OpenFileButton.Size = new System.Drawing.Size(64, 22); this.OpenFileButton.Text = "打开文件"; this.OpenFileButton.Click += new System.EventHandler(this.OpenFileButton_Click); // // mainMenu1 // this.mainMenu1.MenuItems.Add(this.menuItem1); // // menuItem1 // this.menuItem1.Text = "退出"; this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); // // ConfigeButton // this.ConfigeButton.Location = new System.Drawing.Point(88, 208); this.ConfigeButton.Size = new System.Drawing.Size(56, 22); this.ConfigeButton.Text = "设置"; this.ConfigeButton.Click += new System.EventHandler(this.ConfigeButton_Click); // // button1 // this.button1.Location = new System.Drawing.Point(8, 238); this.button1.Size = new System.Drawing.Size(56, 22); this.button1.Text = "条码打印"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(144, 238); this.button2.Size = new System.Drawing.Size(88, 22); this.button2.Text = "格式文本打印"; this.button2.Click += new System.EventHandler(this.button2_Click); // // Form1 // this.BackColor = System.Drawing.Color.WhiteSmoke; this.ClientSize = new System.Drawing.Size(240, 348); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.ConfigeButton); this.Controls.Add(this.OpenFileButton); this.Controls.Add(this.PrintButton); this.Controls.Add(this.label1); this.Controls.Add(this.InputTextBox); this.MaximizeBox = false; this.Menu = this.mainMenu1; this.MinimizeBox = false; this.Text = "VMP01 PLUS PRINT DEMO"; } #endregion /// /// 应用程序的主入口点。 /// static void Main() { Application.Run(new Form1()); } private void PrintButton_Click(object sender, System.EventArgs e) { if(InputTextBox.TextLength==0) { return; } this.PrintButton.Enabled=false; this.PrintButton.Update(); Vmp01plusPrint(InputTextBox.Text); this.PrintButton.Enabled=true; } private void OpenFileButton_Click(object sender, System.EventArgs e) { this.OpenFileButton.Enabled=false; this.OpenFileButton.Update(); OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ; openFileDialog1.FilterIndex = 2 ; //读取文本文件并显示 if(openFileDialog1.ShowDialog() == DialogResult.OK) { if (openFileDialog1.FileName!="") { byte[] OutBuffer; FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); OutBuffer = new byte[fs.Length]; OutBuffer=r.ReadBytes((int)fs.Length); fs.Close(); //显示GB编码文本 Encoding ANSIEncoding = Encoding.GetEncoding(0);//or GetEncoding(936); Encoding UnicodeEncoding = Encoding.Unicode; 。。。。。。。。。。。。。。。。。
textbox ID="txt" runat="server" TextMode="MultiLine" Width="100%" Height="609">textbox>

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧