473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Is there any bug with VB.Net ContextMenu ??

I have written a VB.Net program. This program has a ConetxtMenu1.
ContextMenu1 is very big and has many levels. There are so many procedures
and depending upon the logic many times a menu item would be visible or
hidden.

I have noticed that in one procedure I am setting the value of a menuitem's
visible property as TRUE but still it is invisible in the Menu.

I have even tested by putting the last statement of the procedure which
executes (opens) the contextmenu as menuitem15.visible = true. So to
understand the structure of the code is :

Button1_Click()

code line 1
code line 2
....
....
....
code line 100
me.contextmenu.show(me.button1, new point(0,0) ------------------- this is
second last line of the code
menuitem15.visible = 15 ----------------- this last line of the code

---------

So the menus opens but still the menutime15 is not visible. Whatever might
be written in the code between line 1 to line 100 (i.e. whether menutime15
is set to visilble or hidden) it should be visible becaue the last line of
the code make it visible.)

I have spent 10 hours in solving this..........................whether this
is a bug?

Thanks in advace!
Nov 20 '05 #1
9 1971
* "I_AM_DON_AND_YOU?" <us**@domain.com> scripsit:
I have noticed that in one procedure I am setting the value of a menuitem's
visible property as TRUE but still it is invisible in the Menu.

I have even tested by putting the last statement of the procedure which
executes (opens) the contextmenu as menuitem15.visible = true. So to
understand the structure of the code is :

Button1_Click()

code line 1
code line 2
...
...
...
code line 100
me.contextmenu.show(me.button1, new point(0,0) ------------------- this is
second last line of the code
menuitem15.visible = 15 ----------------- this last line of the code


You will have to make the menu item visible before showing the context menu.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
i did that "before" , "after", "left", "right", "up", "down" everywhere.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bn************@ID-208219.news.uni-berlin.de...
* "I_AM_DON_AND_YOU?" <us**@domain.com> scripsit:
I have noticed that in one procedure I am setting the value of a menuitem's visible property as TRUE but still it is invisible in the Menu.

I have even tested by putting the last statement of the procedure which
executes (opens) the contextmenu as menuitem15.visible = true. So to
understand the structure of the code is :

Button1_Click()

code line 1
code line 2
...
...
...
code line 100
me.contextmenu.show(me.button1, new point(0,0) ------------------- this is second last line of the code
menuitem15.visible = 15 ----------------- this last line of the code
You will have to make the menu item visible before showing the context

menu.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
....and you know what i also have written (before and after showing the
contextmenu statement):

msgbox menuitem15.visible

and message box shows "TRUE". That means menuitem15.visible = True but
still menuitem15 is not visible.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bn************@ID-208219.news.uni-berlin.de...
* "I_AM_DON_AND_YOU?" <us**@domain.com> scripsit:
I have noticed that in one procedure I am setting the value of a menuitem's visible property as TRUE but still it is invisible in the Menu.

I have even tested by putting the last statement of the procedure which
executes (opens) the contextmenu as menuitem15.visible = true. So to
understand the structure of the code is :

Button1_Click()

code line 1
code line 2
...
...
...
code line 100
me.contextmenu.show(me.button1, new point(0,0) ------------------- this is second last line of the code
menuitem15.visible = 15 ----------------- this last line of the code
You will have to make the menu item visible before showing the context

menu.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Nov 20 '05 #4
I_AM_DON_AND_YOU,
In addition to Herfried's comments.

Can you post the form you are having problems with?

Which version of VS.NET?
Which OS?

Does this occur only while debugging or in release builds also?

Does it occur on other machines, or just your machine?

Hope this helps
Jay

"I_AM_DON_AND_YOU?" <us**@domain.com> wrote in message
news:O1**************@TK2MSFTNGP11.phx.gbl...
I have written a VB.Net program. This program has a ConetxtMenu1.
ContextMenu1 is very big and has many levels. There are so many procedures
and depending upon the logic many times a menu item would be visible or
hidden.

I have noticed that in one procedure I am setting the value of a menuitem's visible property as TRUE but still it is invisible in the Menu.

I have even tested by putting the last statement of the procedure which
executes (opens) the contextmenu as menuitem15.visible = true. So to
understand the structure of the code is :

Button1_Click()

code line 1
code line 2
...
...
...
code line 100
me.contextmenu.show(me.button1, new point(0,0) ------------------- this is
second last line of the code
menuitem15.visible = 15 ----------------- this last line of the code

---------

So the menus opens but still the menutime15 is not visible. Whatever might
be written in the code between line 1 to line 100 (i.e. whether menutime15 is set to visilble or hidden) it should be visible becaue the last line of
the code make it visible.)

I have spent 10 hours in solving this..........................whether this is a bug?

Thanks in advace!

Nov 20 '05 #5
On Tue, 21 Oct 2003 14:49:14 -0700, "I_AM_DON_AND_YOU?"
<us**@domain.com> wrote:
i did that "before" , "after", "left", "right", "up", "down" everywhere.
This works:

Private Sub Whatever()
Dim oMenu As New ContextMenu()
oMenu.MenuItems.Add("Test 1")
oMenu.MenuItems.Add("Test 2")
oMenu.MenuItems.Add("Test 3")
oMenu.MenuItems.Add("Test 4").Visible = False
Me.ContextMenu = oMenu
Me.ContextMenu.Show(Button1, New Point(0, 0))
End Sub

So what are you doing differently?


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bn************@ID-208219.news.uni-berlin.de...
* "I_AM_DON_AND_YOU?" <us**@domain.com> scripsit:
> I have noticed that in one procedure I am setting the value of amenuitem's > visible property as TRUE but still it is invisible in the Menu.
>
> I have even tested by putting the last statement of the procedure which
> executes (opens) the contextmenu as menuitem15.visible = true. So to
> understand the structure of the code is :
>
> Button1_Click()
>
> code line 1
> code line 2
> ...
> ...
> ...
> code line 100
>
>
> me.contextmenu.show(me.button1, new point(0,0) ------------------- thisis > second last line of the code
> menuitem15.visible = 15 ----------------- this last line of the code


You will have to make the menu item visible before showing the context

menu.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>


Nov 20 '05 #6
Hi Don,

If you could zip up the project (forget the setup one) and post it then we
can have a go. Include everything that we'll need (eg, including a copy of the
notepad file) but not the obj or bin directories (which will be recreated).

Then we can all be talking about the same thing.

Regards,
Fergus
Nov 20 '05 #7
On Tue, 21 Oct 2003 15:48:22 -0700, "I_AM_DON_AND_YOU?"
<us**@domain.com> wrote:

Ok, post the code for the button_click function. But quickly to
confirm: you are adding to a ContextMenu object, then applying the
ContextMenu to the form, and then showing it. Yes?


Yes.

Ok. So here is the code written in the button. When for the first time I
click this button it shows the menuitem GLS10. However when I when some
values are changed in the mymenu.txt then it doesn't display. However the
last-line of the code is setting the value of GLS10 as visible = true. The
message box shows "TRUE". But the GLS10 doesn't show-up. (I have delete most
of the code which I think would have any impact on overall procedure)


That code works for me. I hard-coded the value of the textbox as:

TextBox1.Text = vbCrLf & "11111111" & vbCrLf & "1"

In my implementation (I snipped some of the menu items). I don't
suppose this is anything to do with the first blank line?
(TextBox1.Lines(index) - index starts at zero). The menu items toggle
quite happily with my replacing 1 with 0 anywhere...
So what's this other code you snipped? Just more menu items?

Nov 20 '05 #8
Hi Don,

It would be nice to make that menu code generic rather than have
hard-coded character positions against hard-coded menu items!! Change one and,
'oh, boy - what a lot of editing to be done'. This is prone to error too. ;-)

Even if you don't do that, you can at least shorten your code.

This
If row1.Substring(2, 1) = "1" Then
AR.Visible = True
Else
AR.Visible = False
End If

could be done as:
AR.Visible = (row1.Substring(2, 1) = "1")

If you post your project then it can be tested.

Regards,
Fergus
Nov 20 '05 #9
Don,
As Fergus stated, zip the entire project with the form you are having
problems with. We do not need the setup project. The cut & paste code in
your other post is not enough to see what is going on. If we see what is
going on, we can offer better advice on what is wrong.
Does it occur on other machines, or just your machine?

Not tested (because still in development)

By including the entire form, we can run the form as is on different
versions of .NET & different OSs to help track down where the problem is. As
the problem may be an OS version or .NET version specific issue.
Which version of VS.NET?

(Visual Studio.Net (.Net Framework 1.0))

I was asking if you are using VS.NET 2002 or VS.NET 2003, it sounds like you
are using VS.NET 2002.

Hope this helps
Jay

"I_AM_DON_AND_YOU?" <us**@domain.com> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
Can you post the form you are having problems with?

It's a solution with 2 projects. First project 3 form. Second Project is a
setup project.
Which version of VS.NET?

(Visual Studio.Net (.Net Framework 1.0))

Which OS?

Windows 2000 Server (SP3)
Does this occur only while debugging or in release builds also?

Both.

Does it occur on other machines, or just your machine?

Noted tested (because still in development)

Hope this helps

????

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MD | last post by:
I have a ContextMenu that is assigned to 3 RichTextBox's (i.e., if you right-click on any of the 3 RichTextBox's, you get the same ContextMenu). My ContextMenu has 2 items, each of which have their...
2
by: Derrick | last post by:
I've been working on an application which has a NotifyIcon (system tray icon), and a corresponding ContextMenu. I want to be able to update this menu dynamically. However, when I make changes to...
2
by: Zieben | last post by:
Hello! I have such problem! I have my UserControl. I override property ContextMenu for this Control as ..... new ContextMenu ContextMenu{ set {_contextMenu = value;}
0
by: cemino | last post by:
Hi, I got a problem with ContextMenu. I'm using a hot-key (like Ctrl-B) to show contextMenu in my program. Things is like below: contextMenu.Show(Form1, New...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
7
by: TryingLikeHeck | last post by:
I have a usercontrol on which I've generated a context menu in designer. The properties of the control lists for ContextMenu (none) The menu shows up in the designer window and I can edit it To...
11
by: Graham Charles | last post by:
I'm writing a control inheriting from ComboBox, and I'd like to add an entry to the ContextMenu for that combo box. I have no problem if I create an entirely new ContextMenu from scratch, but I'd...
3
by: Libby Sharf | last post by:
Hello, I have several ContextMenus and I want to connect them to the GridControl's ContextMenu property depending on the row that was right clicked. Is there an event that is raised just before...
0
by: Steve Richter | last post by:
I cant get a contextmenu to popup in the context of a datagridview. It pops up in the ListBox, and in the form itself. But not the DataGridView. How could that be? here is my code: using...
3
by: asharda | last post by:
Hi, I am trying to create a context menu in my application. The context menu takes menu otems from an XML file. In XAML the code is <Grid.ContextMenu> <ContextMenu Name="cm" StaysOpen="true"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.