Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

The name 'send' does not exist in the current context


  • Please log in to reply

#1
ryang96

ryang96

    Member

  • Member
  • PipPip
  • 79 posts
hi, i'm a newbie at programing and im trying to make a simple program that you can type something into and it will repeat it. However everywhere i wrote send, it gives me an error that it doesn't exist in the current context. can anyone help me resolve my problem?
[codebox]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
if (textBox2.Equals(""))
return;
Thread thread = new Thread(SendText);
thread.Start();
}
private void SendText()
{
String text = textBox2.Text;
send = true;
while (send)
{
SendKeys.SendWait(text);
SendKeys.SendWait("{ENTER}");
System.Threading.Thread.Sleep(1000);
}
}
private void button2_Click(object sender, EventArgs e)
{
Send = false;
}
}
}[/codebox]
  • 0

Advertisements


#2
ThatGuy1107

ThatGuy1107

    New Member

  • Member
  • Pip
  • 1 posts
You never declared 'send' as a variable in this program. At one point you set the value, but it was never initialized.

public partial class Form1 : Form
{
private bool send; //Add this!
public Form1()
{
...the rest of your code
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP