private void button3_Click(object sender, EventArgs e)
 {
     ServiceReference1.BlogServiceClient proxy = new ServiceReference1.BlogServiceClient();
     if (String.IsNullOrEmpty(textBox1.Text))
     {
         label8.Text = "Please write Id....";
         proxy.Close();
     }
     else
     {
         bool IsUserExist = proxy.DeleteBlog(int.Parse(textBox1.Text));
         if (IsUserExist)
         {
             label8.Text = "Recored deleted successfully";
             BlogClient.ServiceReference1.Blog[] blogs = proxy.ShowBlogs();
             listBox1.DataSource    = blogs;
             listBox1.DisplayMember = "title";
             listBox1.ValueMember   = "Id";
             //label5.Text = label6.Text = label7.Text = label13.Text = label18.Text = "";
             textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = "";
             proxy.Close();
         }
         else
         {
             label8.Text = "This Id field is not Exist.....";
             proxy.Close();
         }
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            ServiceReference1.BlogServiceClient proxy = new ServiceReference1.BlogServiceClient();

            if (String.IsNullOrEmpty(textBox1.Text))
            {
                if (String.IsNullOrEmpty(textBox2.Text))
                {
                    proxy.Close();
                    label8.Text = "Please write title of the blog....";
                }
                else if (String.IsNullOrEmpty(textBox3.Text))
                {
                    proxy.Close();
                    label8.Text = "Please write content of the blog....";
                }
                else if (String.IsNullOrEmpty(textBox4.Text))
                {
                    proxy.Close();
                    label8.Text = "Please write the author's name....";
                }
                else
                {
                    proxy.AddBlog(textBox4.Text, textBox2.Text, textBox3.Text);
                    label8.Text = "Recored inserted successfully";
                    BlogClient.ServiceReference1.Blog[] blogs = proxy.ShowBlogs();
                    //int totaldata=ds.Tables[0].Rows.Count;
                    //label11.Text += totaldata;
                    listBox1.DataSource = blogs;
                    //pass Object into Datasource :: Last solution in mind
                    //listBox1.DataSource = ds.Tables[0].Rows[totaldata-1][0];
                    listBox1.DisplayMember = "title";
                    listBox1.ValueMember   = "Id";
                    //label5.Text = textBox1.Text;
                    //label6.Text = textBox2.Text;
                    //label7.Text = textBox3.Text;
                    //label5.Text = label6.Text = label7.Text = label13.Text = label18.Text = "";
                    textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = "";
                    //textBox1.Text = ds.Tables[0].Rows[totaldata - 1][0].ToString();
                    proxy.Close();
                }
            }
            else
            {
                proxy.Close();
                label8.Text = "Alert!!!!! Please Remove the data from Id otherwise recored will not be inserted.....";
            }
        }
 private void Form1_Load(object sender, EventArgs e)
 {
     label1.Text = "Select a blog from the list...";
     ServiceReference1.BlogServiceClient proxy = new ServiceReference1.BlogServiceClient();
     //DataSet ds = proxy.ShowBlogs();
     //listBox1.DataSource = ds.Tables[0].DefaultView;
     //listBox1.DisplayMember = "title";
     //listBox1.ValueMember = "Id";
     //proxy.Close();
     BlogClient.ServiceReference1.Blog[] blogs = proxy.ShowBlogs();
     listBox1.DataSource    = blogs;
     listBox1.DisplayMember = "title";
     listBox1.ValueMember   = "Id";
     //label5.Text = label6.Text = label7.Text = label13.Text = label18.Text = "";
     //textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = "";
     //label12.Text = ""+ds.Tables[0].Rows.Count;
     proxy.Close();
 }