Posted By: Lwatson | Sep 6th, 2004 @ 7:47 AM
page 1 of 1
Comments: 2 | Views: 11176
Lwatson
Lwatson
One ugly mug...
To start off our company is attempting to broaden its development horizons by becoming as proficient in C# as we are already in VB.NET. With that we have been running across a number of issues that I wanted to see if anyone else out there is having and what if any workaounds exist or more likely what we are doing wrong.

First
Has anyone else out there seen or experianced the Visual Studio forms designer in C# projects just arbritrarily munging the placement of controls at run time when in design time there they sit right where we put em. Note we are being carefull NOT to touch the forms designer generated code only touching the one place in the constructors where we are supposed to put our own code.

Second and perhaps more perplexing
We have a project defined class template with some properties. like so

namespace ProjectX
{
    public class clsMember {
        public clsMember()
        {
        }

        // Main Member Data
        string _bsuNumber = "";
        string _cisNumber = "";

        public string BSUNumber {
            get {return this._bsuNumber;}
            set {this._bsuNumber = value;}
        }

        public string CISNumber {
            get {return this._cisNumber;}
            set {this._cisNumber = value;}
        }
     }
}

Now we have this class in our projects next we might want to use this class within some form class so we define an instance at the form level like so...

static clsMember _member;

Next within the some method inside the form we might want to use the class so we do something like this
public SomeMethod()
        {
           
            _member = new clsMember();

          // do something to fill the class with stuff

          // here we want to use the thing
          
           
            this.txtMemberBSU.Text = _member.BSUNumber;
            this.txtMemberCIS.Text = _member.CISNumber;
                            
        }


Our problem is that the Intellesense on Visual Studio does not show us the public interface on the _member instance of clsMember. It is valid as if I remeber the exact case formatting for the member methods I can certainly code the thing up but Visual Studio's helper functionality is not working as it always does in a VB.Net project.

I can't help but feel the we are just missing something. Or perhaps we have structured the thing incorrectly. So I figured I would petition the SME Gods for a sign.

Let the Flames begin...

Thanks
chuawenching
chuawenching
Love to help
Hi there,

Just remove this line of code:

_member = new clsMember();

and just direct use

this.txtMemberBSU.Text = _member.BSUNumber;

Remember it is static, do you not need to create an instance of clsMember.

Have Fun!
phunky_avocado
phunky_avocado
Dude! It's the (grilled) cheese.
I've seen just the opposite with WinForms in C#:  design-time munging of the UI but at run-time it is all laid out correctly.  For that problem I found the easiest (and rather silly) thing to do was close the form (without saving), then reloading the form.

Lwatson wrote:

[snip]

First
Has anyone else out there seen or experianced the Visual Studio forms designer in C# projects just arbritrarily munging the placement of controls at run time when in design time there they sit right where we put em. Note we are being carefull NOT to touch the forms designer generated code only touching the one place in the constructors where we are supposed to put our own code.

[snip]
page 1 of 1
Comments: 2 | Views: 11176
Microsoft Communities