Click here to Skip to main content
15,900,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using Thread is not successful Pin
taibc6-Aug-12 18:21
taibc6-Aug-12 18:21 
GeneralRe: Using Thread is not successful Pin
Trak4Net13-Aug-12 19:04
Trak4Net13-Aug-12 19:04 
GeneralRe: Using Thread is not successful Pin
taibc13-Aug-12 20:44
taibc13-Aug-12 20:44 
Questionhow to set label text here? Pin
Jassim Rahma27-Jul-12 7:36
Jassim Rahma27-Jul-12 7:36 
AnswerRe: how to set label text here? Pin
Ravi Bhavnani27-Jul-12 8:09
professionalRavi Bhavnani27-Jul-12 8:09 
GeneralRe: how to set label text here? Pin
Jassim Rahma27-Jul-12 9:25
Jassim Rahma27-Jul-12 9:25 
AnswerRe: how to set label text here? Pin
Ravi Bhavnani27-Jul-12 9:40
professionalRavi Bhavnani27-Jul-12 9:40 
AnswerRe: how to set label text here? Pin
OriginalGriff27-Jul-12 9:16
mveOriginalGriff27-Jul-12 9:16 
Please, don't set controls to public - it fixes the design of the form, because you can't change the label out without it affecting (and possibly breaking) outside objects.

Instead, create a public property which allows access, and set the label text yourself within the property. That way, you can replace the label with a more suitable control at some future date, and nothing gets changed outside.
In your search form:
C#
public string Prompt
   {
   get { return myLabel.Text; }
   set { myLable.Text = value; }
   }

In your external class:
C#
search_form.Prompt = "something";

The next problem is that a Form does not contain your controls. You have to cast it to an instance of your search form before the compiler can know what it contains:
C#
foreach (Form form in this.MdiChildren)
{
    MySearchForm search_form = form as MySearchForm;
    if (search_form != null && (string)search_form.Tag == "BROWSE_PATIENTS")
    {
        search_form.Prompt = "something";
        search_form.Activate();
        is_form_exists = true;
        break;
    }
}

Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

GeneralRe: how to set label text here? Pin
Ravi Bhavnani27-Jul-12 9:41
professionalRavi Bhavnani27-Jul-12 9:41 
GeneralRe: how to set label text here? Pin
OriginalGriff27-Jul-12 9:47
mveOriginalGriff27-Jul-12 9:47 
QuestionTrack two types of values within one variable Pin
hpjchobbes27-Jul-12 4:55
hpjchobbes27-Jul-12 4:55 
AnswerRe: Track two types of values within one variable Pin
SledgeHammer0127-Jul-12 6:28
SledgeHammer0127-Jul-12 6:28 
GeneralRe: Track two types of values within one variable Pin
hpjchobbes27-Jul-12 7:04
hpjchobbes27-Jul-12 7:04 
GeneralMessage Removed Pin
27-Jul-12 6:38
professionalN_tro_P27-Jul-12 6:38 
GeneralRe: Track two types of values within one variable Pin
hpjchobbes27-Jul-12 7:18
hpjchobbes27-Jul-12 7:18 
GeneralRe: Track two types of values within one variable Pin
BillWoodruff29-Jul-12 18:35
professionalBillWoodruff29-Jul-12 18:35 
GeneralRe: Track two types of values within one variable Pin
SledgeHammer0127-Jul-12 11:40
SledgeHammer0127-Jul-12 11:40 
GeneralMessage Removed Pin
27-Jul-12 12:22
professionalN_tro_P27-Jul-12 12:22 
GeneralRe: Track two types of values within one variable Pin
SledgeHammer0127-Jul-12 12:33
SledgeHammer0127-Jul-12 12:33 
AnswerRe: Track two types of values within one variable Pin
Eddy Vluggen27-Jul-12 7:13
professionalEddy Vluggen27-Jul-12 7:13 
GeneralRe: Track two types of values within one variable Pin
hpjchobbes27-Jul-12 7:23
hpjchobbes27-Jul-12 7:23 
GeneralRe: Track two types of values within one variable Pin
Eddy Vluggen27-Jul-12 8:24
professionalEddy Vluggen27-Jul-12 8:24 
GeneralRe: Track two types of values within one variable Pin
PIEBALDconsult27-Jul-12 8:15
mvePIEBALDconsult27-Jul-12 8:15 
AnswerRe: Track two types of values within one variable Pin
SledgeHammer0127-Jul-12 11:45
SledgeHammer0127-Jul-12 11:45 
GeneralRe: Track two types of values within one variable Pin
jschell27-Jul-12 11:57
jschell27-Jul-12 11:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.