Chidiebere Mgbemena

Chidiebere Mgbemena

  • NA
  • 179
  • 14.4k

Added Contact wont display in C#!!!

Nov 12 2018 7:15 AM
using Contacts.contactClasses;
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 Contacts
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnAdd_Click(object sender, EventArgs e)
{
contactClass c = new contactClass();
//Get the value from the input fields
c.FirstName = txtboxFirstName.Text;
c.LastName = txtboxLastName.Text;
c.ContactNo = txtBoxContactNumber.Text;
c.Address = txtBoxAddress.Text;
c.Gender = cmbGender.Text;
//Inserting data into database using the method we created in previous episode
bool success = c.Insert(c);
if(success==true)
{
//Successfully inserted
MessageBox.Show("New Contact Successfully Inserted");
}
else
{
//Failed to add contact
MessageBox.Show("Failed to add Contact. Try Again");
}
}
}
 
 When i Add contacts to my form it does not display the following 
 
 "New Contact Successfully Inserted"
 
Please Help!!! 

Answers (3)