when user enters data it will save and i can add/edit data throughout the instance of my main form. when i close out of it and open it again there is nothing there

main form to open add form:

private void AddGamerTag_Click(object sender, EventArgs e)
{


NewGamerTag myGamerTag = new NewGamerTag();
myGamerTag.GamerTagID = 0;



DialogResult result = myGamerTag.ShowDialog();
if (result == DialogResult.OK)
{
try
{
RealLifeAchievementsDataSet.GamertagRow gt = realLifeAchievementsDataSet1.Gamertag.NewGamertagRow();
gt.GamerTag = myGamerTag.GamerTag;
gt.First_Name = myGamerTag.FirstName;
gt.Last_Name = myGamerTag.LastName;
realLifeAchievementsDataSet1.Gamertag.AddGamertagRow(gt);
int rowsAffected = gamertagTableAdapter.Update(gt);
if (rowsAffected > 0)
MessageBox.Show("New Gamertag Created - " + myGamerTag);
else
MessageBox.Show("Problem Occured");
}
catch (Exception ex)
{
MessageBox.Show("Problem creating gamertag" + ex.Message);
}
}
else
this.Close();


myGamerTag = null;
}


add gamertag class:
public partial class NewGamerTag : Form
{
private int _gamertagID;
private string _gamertag;
private string _firstname;
private string _lastname;


public int GamerTagID
{
set { _gamertagID = value; }
get { return _gamertagID; }
}
public string GamerTag
{
set { _gamertag = value; }
get { return _gamertag; }
}
public string FirstName
{
set { _firstname = value; }
get { return _firstname; }
}
public string LastName
{
set { _lastname = value; }
get { return _lastname; }
}


public NewGamerTag()
{
InitializeComponent();
}


private void NewGamerTag_Load(object sender, EventArgs e)
{
OKGamerTag.DialogResult = DialogResult.OK;
CancelGamerTag.DialogResult = DialogResult.Cancel;



gamerTagTextBox.Text = _gamertag;
first_NameTextBox.Text = _firstname;
last_NameTextBox.Text = _lastname;



}


private void OKGamerTag_Click(object sender, EventArgs e)
{
_gamertag = gamerTagTextBox.Text;
_firstname = first_NameTextBox.Text;
_lastname = last_NameTextBox.Text;
this.Close();


}


private void CancelGamerTag_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

if anyone can help me out it would be much appreciated

i added the tableAdapter.Fill method and it is able to work but still only retains data for a short period of time(10 minutes?) lol, my program has short term memory loss

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.