Build An Array Of Controls In A Form?
Sep 5, 2011how do i populate an array with all the controls of a form and their respective properties?
View 11 Replieshow do i populate an array with all the controls of a form and their respective properties?
View 11 RepliesI have put together an array for data from two text boxes to be stored in. This works fine at the moment. I am now looking to build some form of array that will have some stored data in it already, so that someone can select the information they require from a listbox.
View 7 RepliesI am new to VB 2008 express (I am a 'C' coder but have played with VB6 before). I am writing a simple program that will use the serial port. What I would like to do is, upon some trigger event, open a form, and depending on the amount of serial ports available, populate this form with an array of checkboxes with each check box corresponding to an available serial port. The user could then choose a port which would then determine the PortName.
View 1 RepliesI'm creating a simple programming assignment in Visual Basic 2010.(Don't know if it matters, but I'm working in MS Visual Studio.The program consists of two windows forms and a module.Everything works fine except for this one loop I'm trying to use to display whether the answers were "correct" or "incorrect".[code]
View 8 RepliesAny hunk of code that loops trough the windows form controls array, and based on top/left to bottom/right, resets the TabIndex property? I've mashed a huge form together and expect my user community to want to move things around, and I don't want to have to fool around with this over and over again.
View 6 Repliesis it possible to build objects/classes in a way that every field in a table is represented as an object/control in a form? (I heard it, but I don't know if/how it can be done).
For example:
Description = textbox (with the necessary validations)
Country ID = Combo box (foreign key to a related table)
IsCustomer = Checkbox
so I can build a form by creating the necessary fields/objects in it, and every field is a form control with the necessary rules and validations already in place? This way, fields could be "reused" anywhere in the application retaining their characteristics.
I have two controls inside a user control. They are set to be anchored left and right in order too size with the window as it changes size. For some reason I'm having tons of issues getting this to work properly.
Particularly, when ever I build the project and the control reloads itself, these controls triple in size, and extend way off the control. If I re size them and repeat the process it happens again! Anyone have this issue or know what might cause it?
Can someone point me in the direction of a good tutorial on creating and building custom controls that can be added to the Toolbox?
View 6 RepliesGood website for learning to build customs controls?
View 2 RepliesRight now I am building a filter based on user input (textboxes and comboboxes) by a bunch of if statements. There must be a better way. Here is my current code:
Private Function BuildProductsFilter() As String
Dim RawFilterResults As String = ""
If Not CompanyNameComboBox.SelectedValue Is Nothing AndAlso Not
[code].....
I'm trying to migrate a WPF Application based on C# to identical project but based writed in VB.NET.I have some problem with XAML Window.if I build solution with this xaml, it's works correctly. But, if I write:<menus:MenuFullMaintenance Name="Test01" />I have this error message:"Error 8 Type 'My.Frame.UI.WPF.MenuFullMaintenance' is not defined. (Window1.g.vb)"The "Name" property raise this exception...why? How can fix it?
View 1 Repliesi have created control array , now i wann to loop around as well wann to find which control has triggered the respective event my code :
[Code]...
I'm trying to build up a multidimensional array which will hold two bits of info for each record in a database e.g. id, description.[code]...
View 2 RepliesI've got a listbox in visual basic 2008 with lines that look like:
item 0; item 1; item 2; item 3
How can I select that line and change within that line the value of e.g. item 3? (by default it's set to 0 and should be set to a value > 0 when entered by the user.
After that I need to calculate the total price based on the price in item 2 and the new value of item 3 (being >0)
Trying to build a small array to fill a combobox, when I type my code I have no errors in the error list, but when i go to compile/run/debug I get:
Dim arrayDC(2, 2) As Array
Public Sub buildarrayDC()
Me.arrayDC.SetValue("Item1", 0, 0) InvalidCastException was unhandled
[Code]....
I cannot work out the correct formatting of the above type addressing for a textbox in a (sort of) array of textboxes such as
textbox_1
textbox_2
textbox_3
etc.
The controls are on Tabs but I don't think I need to include the Tab as a container control, just refer directly to the textbox on the form, but I cannot work out how this is done in VB .NET format. In VB6 it was relatively straightforward but VB .NEt seems it is different. Can anyone help me with the correct way to formulate
[Code]...
I've been trying to reuse my bosses vb.net buildpacket code which he has successful used for Serial programming eg. SerialPort1.Write(buildpacket(useraddress,252,"0006","0") for the function listed below.My challenge.Create equivalent functionality for Socket BeginSend() which requires a byte array.Whether modifying the vb.net below or getting a c# equivalent to work, it has been repeatedly recommended to scrap the string concatenation approach for which I have to use Encoding.BigEndianUnicode.GetBytes() and then getting rid of extra bytes with zero values.
I'm lacking in imaging something different which would work for socket programming directly and allow me to eliminate all the hassles that c# integer conversions into string value that can be encoded trouble free.I would need to call the equivalent of the following that would return a byte array rather than a string with the following arguments
1. Source address (0-255)
2. Destination address (0-255)
3. Function code ("0001" through "0100")
4 Packet Data Unit (pdu - some integer value
[code]....
How can I add controls to a form in code and set the properties of the controls using the With statement?Also I would like to know how to add a container control and then add a control to that container.
View 2 RepliesI have a slight problem With an enumaration of child controls on a form. The following code will not get but about have the controls that are on the form. The controls show that the count is correct but when it goes through the loop it skips over some of the controls. If you run it through the enumeration two or three times it will get all the controls a few at a time. The solution uses two forms, one that has the controls and the other that labels are made and displayed on. The Tx is just a index to add a number to the label.name and rename the label. So each label is identified seperately. This works for all the the controls that are seen in the for each loop.
View 11 RepliesI created a class that can take either usercontrol.controls or form.controls as a parameter,how can i pass either to that class? as a property or how?
View 4 RepliesI'm trying to make a form in which you would fill in information and then press a "Build" button and it would build another with the information in it so when you open it, it has all the info.
View 1 RepliesI have a module level sub that I use to clear text fields etc on my forms:
CODE:
The problem I have is in the last few lines of code as I'm not really sure how to access the text boxes contained within the tab controls (of which there are many tabs and many text boxes).
This is the closest I've got but I am getting an "option strict on disallows late binding" error on the tabCtl in the following line.
I am trying to build a class that works with a form, but I keep getting the dreaded "Object reference not set to an instance of an object" Error.The form basically collects test grades and assigns them to a collection.My class code is as follows:
Public Class Scores
Private colScoreCollection As New Collection
Public mintSum As Integer
Public mdecAverage As Decimal
Public mintMinimum As Integer
[Code]...
I had a similar project I was working on that had a collection in it, but now that one is giving me the same error. It there something with my version of Visual Studio that is causing this error possibly?
I am trying to build up a login form for my database. I have two fileds Username and password and two buttons Login and change password. I want the change password button to get enabled only if the user enters a default password set by me and the button should remain disabled otherwise.
View 2 RepliesI have been given a VB project by a collegue to import into visualstudio professional to add a setup project to. The project was originally a 2003 projet I don't konw which version, VB express 2003 possibly, then imported into vb express 2008 and now professional 2010.
The problem is every time I rebuild the project without doing anything else the main form changes its size. It shrinks in height by about 40. hit build again and it shrinks again.
what this might be and can it be fixed or will I have to create a brand new project and import the source files with all the risk that that entails.
I'm trying to build an application to monitor a site to build statistics from the data being read. This HTML looks like this.
<div id="history">
<h4>HISTORY</h4>
<table border="0" cellspacing="0" cellpadding="0">
[code]...
Now I can read the html and put the text anywhere, I just don't how to read specific parts so I can separate the data out.
I have a Form with a Media Player in it. Which plays a Song.
[Code]...
It's playing in the background since the Form is hidden. When I play itin Debug, everything works fine. When I run the app outside Debug, I get this error: [URL] The Music File is there, but strangely, there comes this weird error.
is it possible to create array of controls in UI. i need to create array of buttons (as similar to VB6)is there any way to do this?
View 13 RepliesWhen i add a backroundimage to my form and run the program i see the buttons build one by one.I have a form with two panels over eachother. On each panel there are 10 buttons. On the form is a button to bring a panel to the front or send to the back. When i click on that button isee the buttons build one by one. When i have no backroundimage this problem does not occure.
View 1 RepliesI'd like to build a class where I always have a button at the bottom of a form.Then when I drag and drop the button, It has to make a copy of that button called "button1", if I drag and drop the button again I'll have another button called "button2" and so on.But If I drag and drop the "button1" or "button2" they shouldn't duplicate as the original. And this is the problem I can't sort out.
This is my class:
Imports System.Windows.Forms
Imports System.Drawing
Public Class frmTablesEditor
Inherits Form
[code].....