Thread: Update FOrm textboxs from a seperate class

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    85

    Update FOrm textboxs from a seperate class

    I have a Form - Form1, which contains several textboxs all with private accesibility.

    i also have a class - Populate, from which i want to be able to modify the textbox.text values on form1 when i call into it.

    i have tried various methods but nothing seems to give me what i want.

    what is the best way to allow my code to modify textbox.text values WITHOUT compromising the integrity of my original form ? i dont want to expose the textboxs with public accessibility.

    I am calling the method in the populate class from within a ' comboBox1_SelectedIndexChanged ' method which passes over 2 parameters - namely a XMLdocument and a string.

    This method will eventually return a new string but i need to be able to say form1.textbox1.text = "blah blah" in this method and i cant access the textboxs.

    any ideas please. im sure i have done something before where i passed the form to the method but i cant get that to work either and thought there must be another way of exposing the textboxs anyway.

    thanks

    just an after thought - if i instantiate a class at the start of the class ( i.e. form1) rather than within the method i need to access it from (ie comboBox1_SelectedIndexChanged) is there any substantial memory or security issues here ? i understand that fgrom the start of the class it will be available to all methods with the class but does this haver a major impact?
    Last edited by deviousdexter; 05-07-2009 at 09:47 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  3. Replies: 4
    Last Post: 11-15-2008, 06:11 PM
  4. Defining derivated class problem
    By mikahell in forum C++ Programming
    Replies: 9
    Last Post: 08-22-2007, 02:46 PM
  5. Question about getting an info class from another Form
    By Joelito in forum C# Programming
    Replies: 0
    Last Post: 10-16-2006, 01:02 PM