statutoryape 0 Newbie Poster

Hi all,

I have four textboxes. I have a ContextMenuStrip that I want to apply to each of them. My dilemma is that one of the options in the CMS uses the CheckOnClick property, and when I apply the same CMS to all four textboxes when that CoC property is checked it checks it for all of the textboxes. This is not the desired functionality.

I'm still new at VB.NET and OOP but from what I understand instancing is supposed to be the solution to problems like this. I'm thinking I should be able to create one CMS, dim 4 instances of it and have those apply to each of the textboxes. That way I don't have to manually create 4 CMS controls that are all identical.

My issues here are threefold-- (a) I don't know if this is possible, (b) if it is, I don't know at what level the code is supposed to go and (c) the code I came up with doesn't work. "Dim TextOptions1 as New cmsTextOptions" at Form_Load doesn't work. Am I going to have to manually copy cmsTextOptions 3 times and link each control individually?

Any advice would be appreciated. Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.