Results 1 to 3 of 3

Thread: [RESOLVED] VB.net Accessing control on a tabcontrol second tab page on another form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Resolved [RESOLVED] VB.net Accessing control on a tabcontrol second tab page on another form

    Hi
    I have a problem when trying to set the selected index of a combobox that is on a from from a shared/public class. I get no error when I do that for another combobox (called CB_Update_CaseID in the image below) that is on the 3rd TabPage but I get the following error for the combobox that is on the 4th page:


    Name:  2020-10-13_11-25-48.jpg
Views: 352
Size:  25.6 KB


    How will I solve this issue?

    thanks in advance.

    and apology for the title that says "second tab page".

    Edit,
    OK, comparing the properties of those two Combos revealed that the "Modifier" property for the problematic combo was set to "Private". Issue solved.
    Last edited by Grand; Oct 13th, 2020 at 04:45 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: [RESOLVED] VB.net Accessing control on a tabcontrol second tab page on another fo

    What you're doing is bad practice. The "proper" way to do it is to write a method in the target form and let it do the work itself, then simply call that method from the other form. All your controls should be Private and they are in C# by default. They are Friend by default in VB because Microsoft assume that VB developers are more likely to do things the quick and dirty way whereas C# developers are more likely to do things the proper way.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Re: [RESOLVED] VB.net Accessing control on a tabcontrol second tab page on another fo

    Thanks for highlighting that. I also see that this is not the proper way to do it. There will be a clean up.

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