Jerry Murphy
Jerry Murphy

Reputation: 348

My labels text wont change on loading form

I have tried to change my labels text in both the form_load and form_shown methods and nothing happens. I don't want to set the text in the properties as I want to use the text in another label later. Ive tried both these methods neither works.

 private void History_Load(object sender, EventArgs e)
    {
        populateHistoryQuestionArray();
        historyQ1.Text = historyQuestion[0];
    }

and

 private void History_Shown(object sender, EventArgs e)
    {
        populateHistoryQuestionArray();
        historyQ1.Text = historyQuestion[0];
    }

Upvotes: 0

Views: 63

Answers (1)

Vijay Kumbhoje
Vijay Kumbhoje

Reputation: 1441

You must add ToString()

 private void History_Load(object sender, EventArgs e)
    {
        populateHistoryQuestionArray();
        historyQ1.Text = historyQuestion[0].ToString();
    }

Upvotes: 1

Related Questions