I'm working on an menu program right now which has 20 panels used to display bmps that can be clicked on to select things. These panels are simply named something like pnl01, pnl02, etc. to pnl20. I'd like to make them into an array, like pnl(0) through pnl(19), so i can change the bmp on different panels like this:
x = 7
pnl(x).backgroundimage = image.fromfile(file)
i thought this had something to do with enumerated controls but after some searching i couldn't figure out if i was looking for the right thing.
I know that LINQ queries are deferred and only executed when the query is enumerated, but I'm having trouble figuring out exactly when that happens.Certainly in a For Each loop, the query would be enumerated.What's the rule of thumb to follow? I don't want to accidentally enumerate over my query twice if it's a huge result.
For example, does System.Linq.Enumerable.First enumerate over the whole query? I ask for performance reasons. I want to pass a LINQ result set to an ASP.NET MVC view, and I also want to pass the First element separately. Enumerating over the results twice would be painful.It would be great to turn on some kind of flag that alerts me each time a LINQ query is enumerated. That way I could catch scenarios when I accidentally enumerate twice.
I am new at this. Im trying to serialize a panel and its contents in vb. The controls are added at runtime. I have tried adding to a arraylist but it didnt work
I wrote an application using VB.Net 2008 (Not express edition) and in my main form I have several of it panecontrols and on these panels I have lots of other panels that contain controls.My problem is when I switch between the main (split panels) the controls are flicks(flashes) like they draw themselves for a second or two and after that the form is displayed as it should be
I need transparent panels. I simply set that background color of controls to Transparent - this does not solve the problem, as the transparency simply shows the background color of the form, but does NOT show any controls placed on the form, which is the crux of my problem.Why? Because I'm trying to use this skinning example, which does the skin by creating a user control, and make the panels show the skin's background:[URL] It seems I'm going to have to override the panel and paint it's background manually, but I don't understand how it all works; I've created a new class and overridden the panel, but the painting stuff is way above my head.
In the form's class:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Panel1.BackColor = Color.FromArgb(0, 0, 0, 0) 'supposedly a trick to make a gradient background on the form
I have a asp.net placeholder which gets populated with many custom controls, each custom control is a summary of a location containing various facts and interactions. When directly populating the placeholder with the controls they get added one under another down the page. I'm trying to find a way to place each custom control generated in a loop in its own tab (any sort of tab, asp.net/jquery ui etc) so that the user can select the summary they wish to view instead of having to scroll down the page to find it. (I'm using ASP.NET and VB.NET)
Next I have some labels on another form, that due to the design can't be in seperate panels. They are (lblChipColor1 - 6) and (lblChipValue1 - 7). I am trying to populate the color ones from the Array above. I can obviously loop thru the array, but I can't find a decent way to loop thru just the lblChipColorx lables ignoring the lblChipValue1x labels. It would be easy if they were on seperate panels. I tried adding the labels names to an array of type string and of type label, but got nowhere with that. Is there another way to group them, or build const array of label names, that I can work with?
I'm trying to make custom ListBox with some graphics. Base is ItemCollection - each item contains Panel, 2x label and 2x picturebox. What each panel have to do:
- Change backcolor on MouseEnter and set color back when MouseLeave occurs. - On MouseDown(LMB) - Panel stays "selected" - different color.
Problem: I can't access multiple panels at a time(and I need to), just one via sender as in function. Of course, I can do it hacky way, but I want to do it effective and regular. Is ItemCollection the right solution or should I do it just like an array of panels? Also I want them in one "box", ItemCollection is good for it.
Second "problem": I need to make labels "merged" in panels, when i MouseEnter them(labels), background color on that panel sets to my default color. when i MouseClick them(labels), nothing happens (need to "select" parent panel). It can be again fixed with hacky way, just disable labels - but then the colors of labels are unchangeable.
I need codes for array controls radio button. My program is to have auto-generated radio button, when i declare no. in numeric up down that will be the no. of set of the radio button. the program is an exam generated for true or false if you will think of it to have an radio button options for true or false. if i will click the generate button then the radio buttons will appear.
I am using VB 2008 Express edition.I have created a user control that has an enumerated property like:Public
[Code]...
There are 3 alternatives for this property: Member0, Member1 and Member2.Is it possible to change the alternative values of this property in runtime dynamically?
I have a program that will use a lot of panels. The panels will all be on top of each other. Then if you clicked an option on one of the panels it would cause another panel to come up and so on. This is a game so it's not like the panels come up in a set order each time. Depending on what the use selects a different panel could come up in a different order.
z-order or hiding Z-order is supposedly a nicer way to do it instead of hiding so i was going to try that, but sometimes when a panel comes up it has info from another panel on it or the panel doesn't show at all and other things like that.Is there a way i could send all panels to back and bring only the panel i want to front other than doing something like..
I've noticed something in vb that is rather disconcerting, and now i'm trying to find if there is a way around id. Given the nature of enumerated types, they are more or less substitutes for named values, usually grouped in some sensible manner for readability as well as other things. Now, .Net added the FlagsAttribute() for affecting a Enumerated type so that it can reference multiple values (bit flags) for additional support. (Basically it is easier to say If MyEnum And MyFlag as opposed to if MyNum and 65536) However, sometimes we just want to cycle through our enumerated values For x = 0 to N Next I've noticed that with Enumerated types, it is ever so annoying in two folds:
A) Dim X as MyEnumType = 8 '<- Causes a Type Error : Cannot implicitly convert Integer to MyEnumType
B) For X as MyEnum = MyEnum.Lowest to MyEnum.Highest Console.Writeline(Ctype(x, integer)) Next
[code]....
However, as per usual, VB cheats, and performs the latter (violating VB's own Strict Typing rules) and thus if I have 8 enumerated values, each representing a Bit value from 1 to 256, How can I smoothly (with not extraneous executions) run the loop from lowest to highest. (now of course this is bitwise, so i could do a while loop with a << operator, but let us just assume we don't know the values of all the Enumerated elements, we just know they aren't sequential (+1)). I want a loop that ONLY executes the ACTUAL elements of an enumerated type, nothing in between their intrinsic values.
I've created a Form with 1600 Panels. Which are all called Panel (1-1600). E.g. Panel1, Panel2, Panel500, Panel1000, Panel1600 I want a code so that if you click one of the Panels, the BackColor of the panel you clicked on, turns from Control to Red
I think there is an easier code than just adding this: Private Sub Panel1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel1.Click If Panel1.BackColor = "Control" Then Panel1.BackColor = "Red" Else Panel1.BackColor = "Control" End If End Sub To every single panel.
I'd like to set a panel to double buffered to prevent the massive flickering that I've got while I slide panels in and out of my form, but I'm not sure how to.I've Googled it, but all I've found is snippets of code which I don't know how to use. It involves something about creating your own class with double buffering enabled and then creating a panel from that class.
I have one problem. I have small form. on this form i have picure box, larger then form and autoscroll property of form set to true. On picture box i have some panels, which are unvisible by default.
Then i start program. I move down with scroll and on some event i change panel property visible = true. And here i problem. Panel position is not on the same location on picture.
And i tried with changing AutoScrollPosition, it works, but this is not solution.
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
Ok Guys what id like to do is Have a set of buttons across the top of my form and when the user clicks one id like the botom of the form to change to reflect that click. Kind of like the Office 2k7 ribbon but apply that to the whole for
I need to be able to refer to a set of controls on a Windows form using an array, but I'm having a few difficulties.
The Windows form (WForm.vb) contains two textboxes (TextBox1 and TextBox2).
In Module1.vb I have created an array reference to the textboxes thus:
Public wf As New WForm Public ReadOnly TB() As Control = {wf.TextBox1, wf.TextBox2}
Then, in WForm.vb I have tried to refer to the textboxes via the array:
eg.
TB(0).Text = "Change text to this"
I know that the array is referring to the textboxes, because when I hover the cursor over the line 'TB(0).Text = "Change text to this" ' in debug mode, I get the following:
(0)|{Text = "Change text to this"} (1)|{Text = ""}
but for some reason, the text in TextBox1 on the form isn't actually being changed! (There is obviously no problem with change the textbox's text at this point in the code, because I've tried substituting the array reference 'TB(0)' with a direct reference to the textbox 'TextBox1', and the problem disappears.
I've been making a table control for a few days, and I've got to the point of making it capable of accepting new data. To do this, I'm making it generate a row of text boxes, combo boxes, and date selection windows along the row that you're entering data into.
I've tried using an array of 'control' types and changing them to whatever specific control I need as I generate it. That sort of works. For example, the code under 'Case "Employees"' below will make a combo box display on the form, but 'ControlArray(i).Items.Add' gives an error because it doesn't think that ControlArray(i) is actually a combobox yet.
You might also be interested to know that everything will have to be dynamically generated since the table I'm using will not always be the same (and the Select Case code will eventually be replaced by something that checks for relationships in the database).
Dim ControlArray(NumberOfColumns - 1) As Control For i As Integer = 0 To NumberOfColumns - 1 ControlArray(i) = New TextBox
I am rather irritated at this. I have no clue why looping through controls on a form and in groupboxes leaves out 75% of the controls.
Here's the code I have:
Dim settings As String = "" Dim gbControl As Control Dim gbbox As Control
[Code]....
I want to have setting save all settings to an ini file, and not have to reprogram the saving routine when I add a group box or control. At random times, any number of controls can be disabled, checkboxes can be checked and unchecked, radiobuttons can be checked and unchecked. Regardless of the state of the control, I want the control to show up in the loop. But they don't. Only controls that are enabled and only checkboxes that are checked, every other control state is ignored. That's crap, and is definitely not what is needed by any programmer of any type. We're capable of determining if a control is enabled, hidden, checked, visible, and otherwise.
How do I get the controls to be included in the loop regardless of their state?
I am trying to make a form that is blank and will add in 2 comboboxes, a textbox, 2 buttons and a checkbox next to each other in a row. I want the controls to be part of an array, so that all controls on a row are associated with that array number.I am currently able to make the first row appear when the form is loaded, however when i click one of the buttons(which are used to create thenext row of controls) it comes up with an error stating that the index was outside the array bounds.
Here is the code I currently have:
Public Class frmWhere Public SQLString3 As String Public locationy As Integer
I am not sure, but I have understood that, if I want an array of controls with only a method that handles a particular event, I have to define a custom control and add the handler. Is it possible that it does not work with an array of normal controls?