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
  1. Home
  2. General Programming
  3. C#
  4. I tried to set labe control property visible to true

I tried to set labe control property visible to true

Scheduled Pinned Locked Moved C#
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohammed Aijaz Mohiuddin
    wrote on last edited by
    #1

    I tried to set the label control property "visble" to true on a form. This i did from networkoperation.cs class which contains a field referring to form object in Form1.cs . I called a function Matrixdisplay of form as form.Matrixdisplay(row,col); This function contains public void Matrixdisplay(int row,int col) { for (i=0;i

    S 1 Reply Last reply
    0
    • M Mohammed Aijaz Mohiuddin

      I tried to set the label control property "visble" to true on a form. This i did from networkoperation.cs class which contains a field referring to form object in Form1.cs . I called a function Matrixdisplay of form as form.Matrixdisplay(row,col); This function contains public void Matrixdisplay(int row,int col) { for (i=0;i

      S Offline
      S Offline
      Skynyrd
      wrote on last edited by
      #2

      Is the method Matrixdisplay executed in the same thread that created the label controls?

      M 1 Reply Last reply
      0
      • S Skynyrd

        Is the method Matrixdisplay executed in the same thread that created the label controls?

        M Offline
        M Offline
        Mohammed Aijaz Mohiuddin
        wrote on last edited by
        #3

        There are two classes. One is networkoperation.cs and Form1.cs Networkoperation.cs class contains a reference variable form to Form1 class in Form1.cs I am calling the function of Form1.cs Matrixdisplay() from one of the thread of networkoperation.cs class. like this form.Matrixdisplay(); In this function i implemented the visibility setting code.

        S 1 Reply Last reply
        0
        • M Mohammed Aijaz Mohiuddin

          There are two classes. One is networkoperation.cs and Form1.cs Networkoperation.cs class contains a reference variable form to Form1 class in Form1.cs I am calling the function of Form1.cs Matrixdisplay() from one of the thread of networkoperation.cs class. like this form.Matrixdisplay(); In this function i implemented the visibility setting code.

          S Offline
          S Offline
          Skynyrd
          wrote on last edited by
          #4

          try this instead of 'form.Matrixdisplay();': delegate void displayMethod(); form.Invoke(new displayMethod(form.Matrixdisplay),null); When interacting with controls from a thread that is not the 'owner' of the controls (thread where they have been created) you ALWAYS have to use the Invoke method. If in some cases you are not really sure if u need to invoke, u can always check the InvokeRequired property of the control (in this case form). P.D: this might not be the issue at all, but without more details of your code, its the best shot I can think of.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

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