Click here to Skip to main content
15,914,642 members
Home / Discussions / C#
   

C#

 
GeneralRe: stream? how does it work? Pin
Snowjim28-Apr-05 6:47
Snowjim28-Apr-05 6:47 
GeneralRe: stream? how does it work? Pin
turbochimp28-Apr-05 7:22
turbochimp28-Apr-05 7:22 
GeneralRe: stream? how does it work? Pin
Snowjim28-Apr-05 7:31
Snowjim28-Apr-05 7:31 
GeneralRe: stream? how does it work? Pin
turbochimp28-Apr-05 7:46
turbochimp28-Apr-05 7:46 
GeneralAPI commands Pin
c00lguy27-Apr-05 12:13
c00lguy27-Apr-05 12:13 
GeneralRe: API commands Pin
Dave Kreskowiak27-Apr-05 16:22
mveDave Kreskowiak27-Apr-05 16:22 
GeneralRe: API commands Pin
c00lguy28-Apr-05 1:12
c00lguy28-Apr-05 1:12 
QuestionWinForm problem please help? Pin
OnlyTaz27-Apr-05 10:40
OnlyTaz27-Apr-05 10:40 
Can someone please help me with the following code?? I am basically trying to read from an Xml file and display text from that file into a textbox. Everything is ok except for trying to add the text to the textBox.Text i get an error and I don't know why. Are there any books that you would recommend for better understanding windows forms??

Error is:
WindowsApplication1.Form1.textBox1 denotes a field where a class was expected.

the line that causes the error is:
textBox1.Text = (reader.ReadString());

Here is the full code:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Xml;

namespace WindowsApplication1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(48, 48);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(656, 224);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "text";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(760, 350);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
ProcessTest();
}

static void ProcessTest()
{
XmlTextReader reader = new XmlTextReader("c:\\testcj.xml");
while (reader.NodeType != XmlNodeType.EndElement && reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "question":
textBox1.Text = (reader.ReadString());
reader.Read();
break;
case "answer":
reader.Read();
break;
}
}
}

}
}
}


AnswerRe: WinForm problem please help? Pin
Besinci27-Apr-05 14:43
Besinci27-Apr-05 14:43 
GeneralRe: WinForm problem please help? Pin
OnlyTaz27-Apr-05 14:56
OnlyTaz27-Apr-05 14:56 
GeneralRe: WinForm problem please help? Pin
Dave Kreskowiak27-Apr-05 16:19
mveDave Kreskowiak27-Apr-05 16:19 
Generalwinforms app to control browser Pin
fortyonejb27-Apr-05 10:09
fortyonejb27-Apr-05 10:09 
GeneralRe: winforms app to control browser Pin
MoustafaS27-Apr-05 10:18
MoustafaS27-Apr-05 10:18 
GeneralRe: winforms app to control browser Pin
fortyonejb27-Apr-05 15:50
fortyonejb27-Apr-05 15:50 
GeneralRe: winforms app to control browser Pin
Dave Kreskowiak27-Apr-05 16:17
mveDave Kreskowiak27-Apr-05 16:17 
GeneralRe: winforms app to control browser Pin
fortyonejb27-Apr-05 18:03
fortyonejb27-Apr-05 18:03 
GeneralRe: winforms app to control browser Pin
Carl Mercier28-Apr-05 2:06
Carl Mercier28-Apr-05 2:06 
GeneralRe: winforms app to control browser Pin
fortyonejb28-Apr-05 14:11
fortyonejb28-Apr-05 14:11 
GeneralAdding a key to the registry Pin
Anonymous27-Apr-05 10:02
Anonymous27-Apr-05 10:02 
GeneralRe: Adding a key to the registry Pin
Marc Clifton27-Apr-05 10:14
mvaMarc Clifton27-Apr-05 10:14 
GeneralRe: Adding a key to the registry Pin
MoustafaS27-Apr-05 10:20
MoustafaS27-Apr-05 10:20 
GeneralRe: Adding a key to the registry Pin
Anonymous27-Apr-05 10:57
Anonymous27-Apr-05 10:57 
GeneralRe: Adding a key to the registry Pin
MoustafaS27-Apr-05 12:25
MoustafaS27-Apr-05 12:25 
GeneralRe: Adding a key to the registry Pin
Dave Kreskowiak27-Apr-05 16:04
mveDave Kreskowiak27-Apr-05 16:04 
GeneralKeyword coloring (RichEdit) Pin
Matt Newman27-Apr-05 9:29
Matt Newman27-Apr-05 9:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.