FlameBlazer
FlameBlazer

Reputation: 1698

My C# Assembly or my code?

Hello i have this code:

private void button1_Click(object sender, EventArgs e)
    {
        if (radioButton1.Checked)
        {
            UDP.startflood(textBox1.Text, Convert.ToInt32(textBox3.Text), int.Parse(textBox4.Text), int.Parse(textBox2.Text), int.Parse(textBox5.Text));

        }
    }

I get the error "The type or namespace name startflood does not exist in the namespace UDP(Are you missing an assembly reference?)"

Here i part of my UDP.cs:

public Thread[] Sockets;
        public string _Host;
        public int _Delay;
        public int _Sockets;
        public int _Port;
        public int _Timeout;

    public void startflood(string Host, Int32 Delay, int Socketss, int Port, int Timeout)
    {
        _Host = Host;
        _Delay = Delay;
        _Sockets = Socketss;
        _Port = Port;
        _Timeout = Timeout;

        Sockets = new Thread[_Sockets];
        for (int i = 0; i < _Sockets; i++)
        {
            Sockets[i] = new Thread(this.flood);
            Sockets[i].IsBackground = true;
            Sockets[i].Start();
        }

    }
    public void flood()
    {
    i have some code here
    }

Please may someone help me with this? thank you.

Upvotes: 0

Views: 101

Answers (1)

Mike Christensen
Mike Christensen

Reputation: 91716

You're calling startflood as if it were a static method, which it is not.

You'll need to create an instance of your UDP class:

var udp = new UDP();
udp.startflood(textBox1.Text, Convert.ToInt32(textBox3.Text), int.Parse(textBox4.Text), int.Parse(textBox2.Text), int.Parse(textBox5.Text));

Upvotes: 2

Related Questions