Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AWoodgate

@AWoodgate
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ParentForm and a null reference
    A AWoodgate

    I'm not doing any of this in the constructor. A simple case is: I have 2 forms Form1 has a public string, myString, initialised with "ABCDEF". It also has a button that when clicked loads Form2: private void button1_Click(object sender, System.EventArgs e) { Form2 frm = new Form2(); frm.Show(); } Form2 has a label on it, in the label's 'Click' event I try to set it's Text with the following: void label1_Click(object sender, System.EventArgs e) { label1.Text = ((Form1)this.ParentForm).myString; } This causes the NullReferenceException and when I highlight 'this.ParentForm', it shows as Why?

    C# question csharp help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups