CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Location
    Springfield
    Posts
    190

    Form.Text = ""; makes the Form disappear

    I call the MyForm's ShowDialog. The window appears for less than 1/2 second then disappears, and I don't know why.
    Code:
        private void MyForm_Load(object sender, System.EventArgs e)
        {
          Text = "";
        }
    If I change the lines above into the following, the problem no longer occurs.
    Code:
        private void MyForm_Load(object sender, System.EventArgs e)
        {
          Text = " ";
        }
    Why this? I thought I could empty Text without any trouble.
    Mr. Burns

  2. #2
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    Mr. Burns,
    what is Text?

    edit: mah mistake... didnt read it well...

    did you try string.empty?
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  3. #3
    Join Date
    Jul 2003
    Location
    Springfield
    Posts
    190
    Text is a string member of Form class. When you open a Form you can use this member to write something in the title bar.
    No, I haven't tried with string.Empty. What I want is to know what is wrong in my code (the problem is already solved filling Text with " ").
    Thank you Andy.
    Mr. Burns

  4. #4
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    129
    as far as i can see, it is the same thing if you work with cookies in PHP...

    setcookie (name, value);
    is a global function, if you want to set a cookie you write a value, if a value doesnt exist (setcookie(name)) -- the cookie with that name will be deleted.. i believe its how it works, so there shouldnt be anything wrong with your code..
    Regards,
    Alexei

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured