VS 2010 - Recursion Error With Checked Menu Items

Feb 13, 2012

I've got a menu with checkable items that appears on two different forms, and I'm making sure the two forms always have the same check states, so Form1 would have something like this:

Private Sub mnuWarnings_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuWarnings.CheckedChanged
'when one of these is checked, the other should also be

[code].....

But that yields this error:

An error occurred creating the form. See Exception.InnerException for details. The error is: An error occurred creating the form. See Exception.InnerException for details. The error is: The form referred to itself during construction from a default instance, which led to infinite recursion. Within the Form's constructor refer to the form using 'Me.'

There definitely aren't any references to Form1 within Form1.It only occurs when I use CheckedChanged--if I use mnuWarnings.Click, it works fine. And it only occurs in Form1 (the main form); CheckedChanged works fine on Form2.

View 1 Replies


ADVERTISEMENT

VS 2010 - ApplicationSettings Property Binding For Checked State Of Menu Items

Nov 19, 2010

I want to use property bindings under application settings to store settings for my program. However I have run into a problem. For some reason the checked property is not binding to drop down menu item's checked state. The binding works for text boxes and other controls. I have tried to bind both using the checked property, and checked state property. Auto check on click for the menu items are set to true.

Anyone have any recommendations in getting the app-settings property binding to work without the need to manually set that info and manually run My.Settings.Save?

View 2 Replies

VS 2008 - Linq Statement To Go Through A Dropdown Menu's Sub Items And Get What Items Are Checked

Apr 8, 2010

I have the following linq statement to go through a dropdown menu's sub items and get what items are checked: vb Dim UnselectedItems = From xItem As ToolStripMenuItem In tsiSelectObjects.DropDownItems Where TypeOf xItem Is ToolStripMenuItem AndAlso CType(xItem, ToolStripMenuItem).Checked = False

I get this error tho: Unable to cast object of type 'System.Windows.Forms.ToolStripSeparator' to type 'System.Windows.Forms.ToolStripMenuItem'. As you can probably guess i have ToolStripMenuItems and separators in there

However the AndAlso should short circuit in the case where the item is not a ToolStripMenuItem and it doesn't seem to be doing so (as TypeOf xItem Is ToolStripMenuItem=false in this case)?

View 2 Replies

Checked Menu Items?

May 28, 2009

I am able to have checked menu items show the variables that I need to show, but they don't uncheck themselves unless I go back and click them. I want to have only one checkmark on a country at a time...is there any way? I've tried if...elseif , but that doesn't work....example below (If I only want Mexico checked and NOT United States, but both are checked still).

If MexicoToolStripMenuItem.CheckState = CheckState.Checked Then
UnitedStatesToolStripMenuItem.CheckState=CheckState.Unchecked...
End IF

[code].....

View 1 Replies

How To Change (Checked Menu Items)

Mar 27, 2012

I have two menu items from which I choose the interface language of a program (English or French).I want either of them to be chosen, both can not be chosen at the same time. I went over the properties of ToolStripMenuItem object and saw three properties that are confusing (Checked, CheckState and CheckOnClick), how can I mix them so that I get that functionality, I mean that when I check the French, the English gets unchecked and vice versa.

View 1 Replies

Checked Menu Items : Have Only One Checkmark On A Country At A Time?

Jun 21, 2010

I am able to have checked menu items show the variables that I need to show, but they don't uncheck themselves unless I go back and click them. I want to have only one checkmark on a country at a time...is there any way? I've tried if...elseif , but that doesn't work....example below (If I only want Mexico checked and NOT United States, but both are checked still).

If MexicoToolStripMenuItem.CheckState = CheckState.Checked Then
UnitedStatesToolStripMenuItem.CheckState=CheckState.Unchecked...
End IF

View 2 Replies

VS 2005 Check Grid Items If Checked ListBox Items Checked?

Aug 21, 2009

Why is this code having the opposite effect? If It's checked in the checkedlistbox it's not check in my view, if it's not check in my checkedlistbox it is checked in the grid.

EDIT: More specifically. The CheckState.Checked is always the opposite. .Checked means it's not checked.

Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck
Try

[Code]....

View 2 Replies

LINQ Recursion - Getting All Items For Specific System?

Dec 3, 2010

I have a situation where I have a hierarchy. I'm trying to use LINQ to get all of the items throughout the hierarchy as opposed to For Each loops. I spent some time looking for examples, but most where C# using lambdas, and I'm not quite sure I understand it. I'd like to try to get all of the Items for a specific system, the levels of items could be n-levels deep.

Code:
System
SubSystem1
Item1
Item99
Item100
Item2
Item121
Item3
SubSystem2
Itemx
Itemy
Itemz

View 6 Replies

VS 2010 - How To Get Set Of Checked Items In CheckedListBox

Feb 27, 2012

How do I get the set of checked items in a checkedlistbox when an item is checked or unchecked, given that ItemCheck event occurs before the check state is actually updated? (The SelectedIndexChanged event won't work in my case.)

View 3 Replies

DB/Reporting - Menu Strip - Fetch Items From Database And Load In To Menu Items

Nov 28, 2008

I have a menu strip. In the menu strip I have something for some saved urls in the database, I called it Bookmarks. So I'm trying to fetch the items from the database and have it load in to the menu items.. but it keeps adding items and I only want them added once.
[Code]

View 5 Replies

VS 2008 - Change The Hover Color Of Menu Items And Dropdown Menu Items?

Feb 18, 2011

I have currently changed the color of background Menustrip using this code

[Code]...

How do i change the Hover color of menu items and dropdown menu items to orange including the background color which holds icons in menustrip dropdown.....

View 5 Replies

VS 2010 : Display Distinct Items From A Column In A Checked List Box?

Mar 6, 2012

I want to display distinct items from a column in a checked list box then make a selection or selections and perform commands based on info from a second column in that database the database is a small Access 2010 database in the application directory right now I added the data source and items dont display even though I selected that source in the checked list box properties

Dataset = MyDataSet1
CheckedListBox = MyListBox1

I tried it with a combo box and it shows items but includes duplicates, did I setup the datasource wrong?

View 2 Replies

Got A Checked Listbox On Form Which Saves The Checked Items?

Jun 6, 2012

I've got a checked listbox on my form which saves the checked items to a spot in my database on the .ItemCheck event.But there's a problem, when I begin checking items, I check the box and click off it, but it doesn't save. (This is if I've only chosen one item)

If I choose two or more items it will save, but unchecking them takes a lot of clicking around to figure it out.Is there a better event that I can use? I've tried the SelectedIndexChanged and that has the same result, there's a lot of clicking around in the checkboxes to end up with the desired selected items, and it does not allow a single item.

View 6 Replies

Recursion Error Down To One Subroutine

Jun 21, 2012

I've tracked a recursion error down to one subroutine, So when my form loads, it populates some listboxes from a database; any one of these causes the error:
ListboxQuery("select sculptname, sculptid from sculptures;", CloseSculptList, "sculptname", "sculptid")
ListboxQuery("select distinct eventtype from events;", EventTypeList, "eventtype", "eventtype")
'etc, etc

And here's the subroutine (it's querying a MySQL database):
Public Sub ListboxQuery(ByVal queryText As String, ByVal resultObject As Object, ByVal resultDisplay As String, ByVal resultValue As String)
'queries the database for a 1- or 2-column list of values to display in a listbox
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
[Code] .....

The error is the standard recursion error:
An error occurred creating the form. See Exception.InnerException for details. The error is: The form referred to itself during construction from a default instance, which led to infinite recursion. Within the Form's constructor refer to the form using 'Me.'

This is weird for two reasons: One, as you can see, the subroutine doesn't refer to the form at all, so I don't see how it could cause a recursion error, and two, I wrote this subroutine almost a year ago and it only caused this error last week.

View 10 Replies

VS 2010 Running Menu Items From With VB?

Nov 10, 2011

I have a form which has a menu bar. This bar then has sub-menus i.e. the top menu is passwords and the 2 sub menu's are change password and delete password.This works fine when the user selects the menu item by clicking with the mouse

Private Sub ChangePasswordToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ChangePasswordToolStripMenuItem.Click
PasswordForm.ShowDialog()
End Sub

What I want to do is under certain conditions run the menu item automatically from within the code.

View 8 Replies

VS 2010 Sorting Menu Items?

Feb 24, 2012

I have a Windows form with a menu strip (the built-in one, nothing custom).I want to add a new list of items to one of the current menu items programmatically (no problem, done that).The new list of items I am adding is unsorted, but I want them to appear on the menu in alphabetical order.

View 7 Replies

VB 2010 Create A Calculator For Fuel Usage With Menu Items?

Jan 18, 2011

i am trying to create a kind of calculator for fuel usage with menus lemme show ya the code:

Public Class frmFuelCalc
Private Sub AboutFuelCalcToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutFuelCalcToolStripMenuItem.Click
MsgBox("Guru Software" & vbCrLf & "Fuel Calculator Version 1.0.0.0" & vbCrLf & " Copyright 2011 © " & vbCrLf & " Guru Software Design â„¢ All Right Reserved", MsgBoxStyle.Information, "Fuel Calculator")

[code]....

View 1 Replies

VS 2010 Converting Recursion To Iteration?

May 10, 2010

Is it possible to make this function iterative or must it be recursive?

The Function traverses a grid of x length and y height. At each point in the grid, it checks all of it's neighbors to see if they are valid, meaning they exist in the grid and haven't been used yet.

The function works in it's current form but I was wondering if an iterative version would be more efficient.

PathManip is a Stringbuilder, stores the path currently being manipulated. PathQueue is a List(Of String), stores all paths yet to be traversed.

IsPathAlreadyUsed is a boolean function that checks whether or not a specified point has been used in the current path.

Sub FindNeighbors(ByVal coords As String)
Dim x As Integer = CInt(coords(coords.Length - 2).ToString)
Dim y As Integer = CInt(coords(coords.Length - 1).ToString)

[Code]....

View 18 Replies

Error - The Form Referred To Itself During Construction From A Default Instance, Which Led To Infinite Recursion

Apr 14, 2010

I have two forms. A main form and then another form that you can change settings in. Now when I click on the menu item to get to the settings form I get this error. "An error occurred creating the form. See Exception.InnerException for details. The error is: The form referred to itself during construction from a default instance, which led to infinite recursion. Within the Form's constructor refer to the form using 'Me.'"I've tried these codes.

frmSettings.Show()
Application.Run(frmSettings)

those didn't work so i tried these

dim settings as new form = frmSettings
settings.show()
dim settings as form

[code]....

and those didn't work. I'm using visual studio 2010 Pro.

View 6 Replies

VS 2010 - Form Constructor Recursion Exception

Aug 15, 2010

I developed an app, tested on few computers and all seemed fine. But now, some people suddenly get an error, which I can't repeat on my computers. Part of the exception:

** Exception Text **
System.TypeInitializationException: The type initializer for 'NumoABC.functionsBurtuSummas' threw an exception. ---> System.InvalidOperationException:
The form referred to itself during construction from a default instance, which led to infinite recursion. Within the Form's constructor refer to the form using 'Me.'
at NumoABC.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 180
at NumoABC.My.MyProject.MyForms.get_MainForm()
[Code] .....

The If Me.Created = False Then is because while the form is loading, some events fire the updatePersonDataHandlers() sub, but I don't want it to happen until form is fully loaded. In the module functionsBurtuSummas line 2
Module functionsBurtuSummas
Private f As MainForm = MainForm
I have many modules who work with the MainForms' controls, so I use a private variable f to refer to the MainForm.

View 28 Replies

Menu Strip Has Disappeared But The Menu Items Are Still Showing In Properties List?

Oct 6, 2011

I have combed these forums and the 'net and can't find an answer to my specific problem. My menu strip disappeared (after deleting a small secondary form within my project). I therefore created a new strip and while recreating the menu items realized that the original menu items are still present, showing in my properties list. I have checked my design file as well and the original menu strip is definitely gone but the original menu items are there. I don't have many items so I would have no problem just deleting the original ones but I can't see them to delete them! I have checked and they are all set to visible. I have also moved everything on my form to see if it is behind anything else.

View 4 Replies

Clone The Menu Items And Then Bound It To Form Context Menu?

Nov 26, 2009

Suppose I have ToolStripMenuItem mnuOrderOptions that contains the three drop down items. I want to copy all the items are their respective event handlers to Contextmenu on button click & then bound that context menu with the form.

Private Sub AToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AToolStripMenuItem.Click
MsgBox("A")
End Sub[code]....

how to clone the menu items and then bound it to form context menu.

View 3 Replies

Dynamic Sql Menu - Create A Menu Based On Items In My MS SQL Database

Aug 23, 2011

I am wanting to create a menu based on items in my MS SQL database i have 3 tables

FormTbl

FormID - Int Eg (1)

FormName - nvarchar(50) Eg (Form1)

[CODE]...................

I can get the form names to be populated in to the menu and can open it my question is how do i set where the menu items will be placed. Eg File with FormHierarch 0 will be the very first one. Exit with FormHierarch 0.1 will be the very first one under File

Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim menu As New MenuStrip()
Dim dst As DataTable = User.MenuItems(Me.ToolStripStatusLabel1.Text)

[CODE].....................................

View 2 Replies

Menu Items  By Making Several Of Them Submenus To Another Menu Item

Jun 1, 2010

I have a MenuStrip with many submenus. I want to rearrange some of the menu items by making several of them submenus to another menu item.[code...]

View 2 Replies

Visual Studio 2005 - Menu Items,Toolbar Items ,etc Displayed In Duplicate?

Jun 1, 2009

My visual studio 2005 has been running great up till now The menu items in the menu toolbar display exactly as follows:File File Edit Edit View View File File Edit Edit View View Tools Tools Tools Tools Window Window Community Community Help Help Window Window Community Community Help Help

Error List is displayed as follows:(I've excluded the icons)0 Errors 0 Errors 0 Warnings 0 Warnings 0 Messages 0 Messages The standard toolbar images are also displayed in 'duplicate'

This is before I open a project and visual studio is on the start page. The 'duplicates' do not go away even when a project is open.When project is open, Solution explorer displays duplicate images as well

I've tried all the following but still cannot get it to display normally. Restored my computer to a time when it was working ok. Full scan on my computer with AVG premium which includes spyware etc (No viruses , etc found) All software is updated fully

View 13 Replies

Add Items To A Checked Listbox?

Jan 11, 2011

I was wondering if there was any tut on how to aan item to a checked listbox thats already populated?

I thought of making a button and a text box .and when u push the button it add whats ever in the text box to the checklist box .

View 5 Replies

How To Know Which Items Are Checked In ListBox

Aug 10, 2011

I am reading information on missed deadlines from a database. For each missed deadline I add a item to the checked listbox and store the deadline's information in an array. I now want to disiplay all the selected (in the checkedlistbox) deadlines' information in another control, but at the moment I am getting an error. This is the code I am currently using to check which items have been selected

Dim x as integer
For x = o to array.count - 1 do
If checkedlistbox.GetItemChecked(x) = true do
'Here I am displaying array.item(x)'s information in the other control
end if
next

1) Say I have five items in the checked list box and I select all five items, when it gets to x= 3 it gives me the following error "ARGUMENT OUT OF RANGE EXCEPTION was unhandled: InvalidArgument=Value of '3' is not valid for 'index'. Parameter name: index"
2) Say I have five items in the checked list box and I select ONLY the first two items, when it gets to x=4 it gives me the same error as above only for the number 4.

I have tried the methods/functions GetItemCheckedState, SelectedIndices and GetSelected as well, but they all give the same or similar errors. According to me the index cannot be out of range as I have five items in the checkedlistbox as well as the array.

View 2 Replies

Asp.net - Want The Checked Items In The Arraylist To Be Added?

Jan 28, 2011

having trouble only adding the checkboxstatus's that are checked to the gridview.

[code]...

View 1 Replies

Count Checked CheckedListBox Items?

Apr 12, 2010

I have CheckedListBox and four item in it!Now I want to count number of checked item. For this I use:

countnumber=CheckedListBox1.CheckedItems.Count

But countnumber is always 0 even if I checked CheckedListBox items or not!

View 1 Replies

Counting How Many Items Checked In ListBox

Apr 13, 2009

Is it possible to count how many checked items there are in checkedlistbox and then display that number in a textbox?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved