I am missing the drop down lists used to navigate between form events in the VB code editor.
I am trying to get the event windows back into the code designer.
class name and method name dropdown list is missing (visual studio setting)
unchecked and rechecked the "Navigation Bar"
Related
I recently installed VS 2019 Preview, and i'm facing this issue:
In my VB code editor, in the navigation bar, when i try to choose a class (button, dropdowlist,...) it's not working: the list of classes it's not refreshing, the class i tried to select is not selected, so i can't be able to edit/create an event for the class i need to edit. I manually have to search for the event, or to create it manually.
Is it malfunction of the Editor? is it a bad configuration? or do i need to re-install VS 2019 ...?
Thanks in advance, looking forward for your comments on above.
I am not sure why your chose the Preview edition. I never used it. I have the latest VS 2019. In my version I can choose any control on the form in the middle drop down and the events for that control appear in the right drop down.
Another way to add the stub for an event procedure. Is available in Design View. Select a control and view the properties window. On the toolbar choose the lightning bolt. All the events for that control are listed. Double click on the event you want and the stub will be inserted in the code editor.
Of course, you can always just type in the event procedure, as long as it has the correct signature and handles clause, it will work.
So in C# to declare and instantiate a UserControl, you would go about it similar to this:
UserControl1 userCont = new UserControl1();
userCont.Show();
And this would show your user control named UserControl1.
This is the way you do it in C#, now how do you do this in VB?
Because I have coded an Excel Add In, and have put a userControl in the ribbon, but it does not want to show, and that project is in VB, not C#.
EDIT:
Some explanation of my project:
I have an Excel 2013 and 2016 VSTO add-in project type.
I have 3 classes, namely:
UserControl1.vb - as my userControl
Ribbon.vb - as my ribbon class
ThisAddIn.vb - as the add in class
My userControl is rather simple, it has 3 buttons, a "Yes" button, a "No" button, and an "Add Tables" button. It has 1 listBox, and 12 checkboxes...
The Ribbon is also quite simple, I have 2 buttons in the Ribbon called "Show" and "Loop"...
The ThisAddIn class contains code that will make this add in work, such as methods and general functionality...
Okay so that's my classes...
The goal of my project is:
When the "Show" button is clicked, a CustomTaskPane will appear in excel on the right, inside this customTaskPane will be my userControl...
(This works)
Big thanks to DrDonut for his answer
When the "Add Tables" button is clicked (in the userControl), I want excel to iterate through all the sheets, and add every listObject's name (tables name) to the listBox.
(The Loop and Add Tables button are the same)
In C# I know you go:
this.ListBox1.Items.Add("Item 1");
And that will add an item to the listbox, the same principle is applied in VB, but with my ListBox sitting in my userControl which inherently sits in the CustomTaskPane, no items can seem to be added...
(Adding items to the list box does not work)
And with regards to the looping of tables, or retrieving their names, this doesn't work either...
(This is what I really want to get going nicely)
Hope this edit will shed some clarity on the situation...
Some gritty information:
OS: Windows 10 Pro (x64)
RAM: 32gb
CPU: i7-6700 #3.40ghz
Microsoft Visual Studio Community 2015
Microsoft Excel 2016 (x64)
In vb.net it's quite similar, for a task pan (the panel at the right side of an office application) it is:
Dim userControl as UserControl
Dim userTaskPane as Microsoft.office.tools.CustomTaskPane
userControl = new UserControl
userTaskPane = Me.CustomTaskPanes.Add(userControl, "Title")
userTaskPane.visible = true
Now it should show the panel.
Edit: Source: https://msdn.microsoft.com/en-us/library/aa942846.aspx
Edit 2: You also need to set the right references. Assuming that you use visual studio, go to the solution explorer -> Your project -> References. In my project these contain the following:
Microsoft.Office.Interop.Excel
Microsoft.Office.Tools
Microsoft.Office.Tools.Common
Microsoft.Office.tools.Common.v4.0.Utilities
Microsoft.Office.Tools.Excel
Microsoft.Office.Tools.v4.0.Framework
Microsoft.VisualStudio.Tools.Applications.Runtime
Office
I don't know if you need all of them, but for sure you will need some of them.
Okay, in Visual Studio 2012 I have a VB.NET project with originally two forms. Form1 was originally set as the startup form and then obsoleted. Form2 is a nearly identical form that has all of the new desirable functionality.
In my project's settings, Form2 doesn't appear as an available option for Startup Form. (Though it is a normally-created form that inherits Form) After some "troubleshooting," Form1 has been deleted, resulting in the the "Enable Application Framework" option being disabled and no Startup Object being available. When I select anything from the Startup Object drop-down, either Sub Main or Form2, I have an error message stating either "Sub Main not found in Solution" or "Form2 is a type in Solution and cannot be used as an expression" respectively. If I try to enable "Enable Application Framework," I receive an error popup stating "Startup object must be a form when 'Enable application framework' is checked." And Application.Designer.vb is empty.
Some things I've tried:
Clean and Rebuild Solution
Restarting Visual Studio
Temporarily deleting Form1 (it's still excluded from project)
Added a new form, per Neolisk's advice. It appeared in the available objects. I selected it and turned on application framework. From here, I copied the initialization code from Form2's designer code into Form3's. All was alright. Then, I copied Form2's main code into Form3. Now, "Form3 is a type in Solution and cannot be used as an expression" appears in my error list.
With that said, my question is how can I get Visual Studio to recognize my form as a form and set Form2 as the startup object?
add InitializeComponent() in new() function in form2
Found it! The issue was an overload of the form's constructor taking a form as a parameter. Since this was the only constructor in the file, I guess it caused confusion. Commented that out and all was right with the world again.
Sometimes you have a different class name from the form file name.
Check if the class name is listed.
I have created infopath form library in SharePoint sever2010. I am using Windows server 2008R2 OS and MS-Office 2010. When i clicked on "Add new document" in form library, it is asking a .xsn template.
I created a template using infopath 2010 and assigning to it.
But it is saying that:
The element 'comment' is used but not declared in the DTD/Schema..
I tried to publish it by using Infopath 2010, it is saying that :
The element 'comment' is used but not declared in the DTD/Schema.
again.
Can any one explain the procedure how to solve these errors....
This error could occur if:
The template you created with InfoPath designer is not published to SharePoint - therefore when you click New -> New Document, you are asked to provide a template to use. Now if you supply any arbitrary template, you will get this error.
You can try following steps:
Publish the template you created to sharepoint Server. Check 'Enable this form to be filled by browser'.
You said very simple template so I am assuming there is no custom code associated.
Select publish to form library. Create a new form library, if not already done so; else use existing form library.
If you create new Form library from InfoPath, things are easy, when you click on 'new document' in your 'form library', you will see the form in browser.
If you publish to existing Form Library then follow these steps:
In your form library click settings -> Advanced settings.
Select 'Yes' for 'Allow management of content types?'.
For 'Default open behaviour for browser-enabled documents:'
Select Use the server default (Open in the browser).
Click Ok.
Back on the settings page you should see: 'Add from existing site content types' in the 'content type' section. Click it and on the ' Add Content Types' page select group 'Microsoft Office Infopath' or 'Microsoft Infopath', which ever your content group is, and you should see the name of your form. Add this and click ok.
Back in your Form Library, you should see two InfoPath forms on your New button.
Well that's that, you can get rid of one of them.
i want to see the designer code ..
i want to see how myForm is generated using or extending form
i mean in C# i can see the code in designer.cs file...but in vb.net i am nt able to see that..
In VB.Net, in order to see the designer files, you have to click the toggle button above the solution explorer (show all files).