I am using microsoft chart controls in VB.net. The graph data currently comes from my database, but all the series and chart formats were made before runtime. I want to know how to make charts on runtime, being able to select the x axis from my dataset and multiple y columns from my dataset. Thanks
"Made before runtime" is very unclear, I'll assume you used the designer and changed properties in the Property grid window.
In the Solution Explorer window, click the "Show All Files" icon. That shows a node next to your form, open it and double-click the Designer.vb file. Scroll down to the InitializeComponent method, you'll see code that was generated by the designer to initialize the chart control.
Copy and paste this code into your own method. That gives you a major running start on the code you need to configure the chart yourself at runtime.
Related
I have a set of controls which are added dynamically to a panel. The number of controls depends on which tab a user selects from TabPage control, which is embedded in a form.
At the moment, the controls don't appear in Designer, but appear during execution.
I managed to display controls for other forms which are not dynamic by moving the non-design code to the vb file, but how can I display the other ones?
The only answer that I know of is to add your code in the .Designer.vb file of the Form.
BUT! I strongly advise you to avoid that if you are not sure how it works! Custom code in the .Designer. files can break your form design and project with possible random crashes.
Also, your code can be changed and removed by the Visual Studio designer:
Custom code in designer.vb file goes away when making edits in design mode
Instead, you can make the panels into custom user controls and add those to the tabs.
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.
I have made some borderless Form1 in my solution, now I want AboutBox will have same design and also I need more 2,3 Forms but same style.
If I click "add new item" or "existing" it add the main Form like default Visual Basic has :'(
How should I proceed?
In fact, all the design of the form is stored in the Form.Designer.vb! file.
You can simply copy the properties you wish to apply to the added forms and past it in their designer accordingly.
Check image below to see the designer.
Modify the form as you wish them to be.
Once done, save the changes
Open the designer and copy all the codes
Add another form.
Open its designer and paste all codes
Change the name of the form
The form will be a duplicate of the previous one and you can adapt your changes.
instead of dragging and dropping a common control in vb.net, is there a way to hard code it?
or is there a way for me to be able to view the codes where a dragged and dropped object has
been created? thank you so much!
The auto-generated code is intentionally hidden in the VB.NET IDE. But you can easily reveal it. Click the "Show All Files" toolbar button in the Solution Explorer window. You'll now see the Form nodes in your project displayed with a triangle. Click on it to reveal the Designer.vb file. And double-click that to see the code.
Observe the changes in the InitializeComponent() method as you use the designer to add/remove/edit controls. It isn't perfect code, the machine generated it, but it gives you a major leg-up on what kind of code you need to write to "hard-code".
I want to load a JPEG or any kind of picture file from a database into an activeX control on a user form. I want the picture to resize to that of the activeX image control. There are a lot of times when I've used ActiveX controls:Filepreview where they sometimes need to be re-size because it is open larger once they've been clicked. How can I do this in VBA?
My objective is to find .ocx file which is using activeX control for image or picture to apply my project and then register it to the VBA finally find method or function resizing picture. On the form and be able to resize them when I choose one.
thanks in advance
If you just want to add an ActiveX to your project;
- Right-Click on free space of Toolbox;
- Select Additional Controls ...;
- From Available controls select your own;
If your favorite ActiveX not found in list, run this command line:
regsvr32 <file path and name>.ocx
After re-entering it should be added to list.