I am getting 5 errors as mentioned below:
Error 1 The name 'txtTo' does not exist in the current context
Error 2 The name 'txtMessage' does not exist in the current context
Error 3 The type or namespace name 'WhatsApp' could not be found (are you missing a using directive or an assembly reference?)
Error 4 The type or namespace name 'WhatsApp' could not be found (are you missing a using directive or an assembly reference?)
Error 5 The name 'data' does not exist in the current context
Could someone please help me with the above errors?
Here is the code that i am using:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnSend_Click(object sender, EventArgs e)
{
//Send ( button_click )
string from = " ";
string to = txtTo.Text;
string msg = txtMessage.Text;
WhatsApp wa = new WhatsApp(from, "S2pRzjF5WnVcHCwGFkjJuFI2oCM=", "Shri", false, false);
wa.OnConnectSuccess += () =>
{
MessageBox.Show("Connected to whatsapp...");
wa.OnLoginSuccess += (phoneNumber, data) =>
{
wa.sendmessage(to, msg);
};
wa.OnLoginFailed += (DataBindings) =>
{
MessageBox.Show("Login Failed : {0}", data);
};
wa.Login();
};
wa.OnConnectFailed += (ex) =>
{
MessageBox.Show("Connection Failed...");
};
wa.Connect();
}
}
}