How do I work in 'reverse' (from code to get a form) in Visual Basic? - vb.net

I found a code for my project I have due online for Visual Basic. When I paste the code into Visual Basic and click run, is there a way for Visual Basic to make the form for me? Or do I have to make the forms myself based on the code?

You have to create the form yourself:
Create a Form.
Insert your existing code. Comment everything inside the class.
Create the controls.
Name your controls with the names your code needs.
Un-comment the previously commented code.
Have fun.

You can create different controls inside your class by code only as you wish, but you must create your form first, unfortunately this must be done manually

Related

VB in Visual Studio Adding a class module will it have access for the form.vb I've built?

Hello thanks for reading my question, I've build a user form with controls to control equipment via RS232 and USB. I've also added a separate class module "class.vb" to hold miscellaneous functions like writing to an ini file.
When I'm in the code section of the Form.vb and I type txb for text boxes that I have in the form visual studio pops up a nice list of all things in the form that start with txb.
However, when I do the same thing in my class.vb it does not do this and even if I type the whole thing such as txbModulation and then add the dot after it does not come up with the list of properties.
Does the class.vb have access to Form1.vb controls?
When I'm in the code section of the Form.vb and I type txb for text
boxes that I have in the form visual studio pops up a nice list of all
things in the form that start with txb.
This is because when you start typing a variable name, Visual Studio starts looking for a match. It looks in block scope first (a for or while loop maybe), then at local (function/sub) scope, and finally at class level (a form is a class). It will also look for any matches in Modules if you have them. See Scope in Visual Basic for more info.
Since the Form and your INI Class are different, they cannot see each other unless you pass references or somehow pass values via parameters to subs/functions.

How to find a form from many forms in vb6 on a existing project

I am working on a old project of vb6 which has hundreds if forms. I am able to run the application and have to fix a runtime error in a form which pop up. I don't know the name of the form and only have visual reference. I tried using debug but It has continues SQL statements running in a loop. Any advice is appreciated.
Thanks.
Search the code for the form caption, or the labels of controls on the form, using visual studio's "find in files" or simlar function of your favourite editor.
If the caption is set in the form design, this will take you to the .frm file the form is stored in. You can open this in Notepad or another editor to get the name of the class (which is usually the same as the filename).
If the caption is set in code, you can place a breakpoint on that line. Again, this will lead you to the code which instantiates the form.

How to create ListBox with code only?

I googled a lot but I had absolutely no luck finding anything about my problem.
I would like to create ListBox - just like the one anyone can create using UserForms. The problem is that I do not want to draw it but write it with a code. I know how to add values to ListBox etc. The only thing I am missing is how to create it programatically.
I found this: Creating form programmatically in the module using vba but this code didn't work for me. It stops at declaring Forms.
The idea behind this ListBox is to create a ListBox to choose from sheets in a workbook to later do some stuff.
Me.Controls.Add ("Forms.Listbox.1")
allows you to add a control at runtime only using an event procedure.

Insert javascript code in a list form.

I have a list, and want to insert custom javascript code in a new form for this list (when form loaded). For example, when new form for this list is opened, I want to make some layout modifications for this form.
How it can be done? And how many ways exist to achieve this?
Thanks.
Upd: I ask about SharePoint list, and SharePoint list forms, I suppose you look at the tags of the question :).
You put tags for both SharePoint 2007 and 2010 and the methods are a bit different.
I agree with the previous post that with SP2010 you can simply use InfoPath designer for form design and do whatever you like to the look.
In SharePoint 2007, there are a couple ways incuding using SharePoint Designer, editing the form .aspx file, hiding the out of the box form and inserting a custom form which you will then be able to edit. You can also add in JavaScript code there as well.
My preferred method if you are just making some visual modifications is always JQuery which you can add in to a content editor and you can look for the particular tags surrounding rows or columns and attach to them and make your changes.
I think your question and tags need further clarification to get an articulate answer from anyone that will actually help you.
You can edit the layout using InfoPath 2010 like described here:
http://office.microsoft.com/en-us/sharepoint-designer-help/edit-list-forms-using-infopath-2010-in-sharepoint-designer-HA101631624.aspx
If you've got the SP2010 Foundation or SP2007 version, you can create custom list forms using SP Designer which gives you the option to do whatever you like since those are .aspx files.
http://office.microsoft.com/en-us/sharepoint-designer-help/create-a-custom-list-form-HA010119111.aspx
You can also edit the aspx List form in SP designer. To add Javascript or jQuery you should create a form for New in PS design then edit in Advanced mode to insert your Javascript in the proper place. There are many tutorials on the Web that talk about this... Also, you can add content editor webparts to the new aspx page where you can insert your Javascript or jQuery.

Referencing user controls that are contained within the same VB.NET project

I do apologize if this post is a duplicate, but I haven't found anything similar when I searched.
I'm fairly new to VB.NET and I'm currently playing around with user controls, figuring out good programming practices. As far as I understand, to create and use a UserControl, I need to create a project with the UserControl in it, then build the project and use that DLL (add it to Toolbox or otherwise).
My question is this: Is there a way a have a project (a Form with a bunch of things on it) that contains a UserControl written in a *.vb file inside that same Project? If you do that, the DLL (in my case) never gets produced, possibly because the UserControl is never used and building it is simply omitted. Is it perhaps a bad practice to do that altogether? It simply makes sense to me to keep a UserControl as a part of the Project that uniquely uses it. Is there a reason not to do that?
Thanks in advance! = )
SOLUTION:
Visual Studio does not automatically include your own controls to the toolbox by default! In order to change that, go to Tools>Options>Windows Form Designer>General and set AutoToolboxPopulate to True. When you build your project next time, your new Control will appear in your Toolbox.
It's a perfectly valid design decision to include a UserControl in a WinForm or WPF project that uses it. If you do this then VS will not create a DLL for the UserControl; instead the UserControl will be built into the assembly your project is producing.
If you did want to reuse a UserControl in multiple projects then you would want to create separate project that generates a DLL that can be reused.