GlobaLevel
asked on
ERROR: The name 'textbox1' does not exist in the current context
I ma trying this simple program in Visual Studio 2005, however I get this error...here is my code:
public static void main(String[] args)
{
int txtbox1;
string[] w = new string[3];
w[0] = "Hello";
w[1] = ",";
w[3] = "world";
for (int i = 0; i < 3; i++)
textbox1.Text = w.ToString();
}
public static void main(String[] args)
{
int txtbox1;
string[] w = new string[3];
w[0] = "Hello";
w[1] = ",";
w[3] = "world";
for (int i = 0; i < 3; i++)
textbox1.Text = w.ToString();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
I had this error "The name 'textBoxFind' does not exist in the current context" was caused because I inadvertently toggled textBoxFind.GenerateMember to false in the Properties wind in VS at some point. Switched it back to true. Hope that helps anyone else looking at similar error.
ASKER
Error 1 An object reference is required for the nonstatic field, method, or property
Error 2 Cannot convert type 'string' to 'System.Windows.Forms.Text
Error 3 Cannot implicitly convert type 'string' to 'System.Windows.Forms.Text
public static void main(String[] args)
{
string txtbox1;
string[] w = new string[3];
w[0] = "Hello";
w[1] = ",";
w[3] = "world";
for (int i = 0; i < 3; i++)
textBox1+= w[i].ToString();
}
I tried the following but an error:
Class, struct, or interface method must have a return type
Here is my code:
using System;
using System.Collections.Generic
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
public static main(String[] args)
{
string[] w = new string[3];
w[0] = "Hello";
w[1] = ",";
w[3] = "world";
for (int i = 0; i < 3; i++)
return textBox1 = w[i].ToString;
}
}
}
On the form there is a textbox called: textBox1
There is a button called: button1
The goal is to write a simple program that will print out hello, world through an array