When Referencing A Control By The Tab Index I Get The Wrong Control?
Feb 25, 2010
Dim tabnum As Integer = mycontrol.TabIndex
If My.Forms.Sessions.GroupBox1.Controls(tabnum).Enabled = True Then
mycontrol.ForeColor = Color.Red[code]....
I have checked and double checked the tab order on the controls and run traces with debug. The control found in my.forms. sessions. groupbox1 seldom returns the proper tab. Using a 'watch' I can see the tab names and the tabname (my.forms.sessions. groupbox1. controls (tabnum).name is often the incorrect one.
View 6 Replies
ADVERTISEMENT
Jan 5, 2011
The code is listed below which hopefully illustrates what I'm trying to do:[code]....
View 12 Replies
Dec 26, 2009
I populated a form with several progress bars and added a function to handle a click event via AddHandler. The event fires and I have been able to do things with the control using the passed object 'sender', but I can't for the life of me determine what the index of the control is in the array.
Why is that important to me? Because I want to click the control, have a container of textboxes become visible, and populate them with data from the reference in my database based on what control was clicked, and update that data as needed. Making the container of textboxes visible, and even moving it based on the location of the clicked control in the array are all done and working fine. I just can't seem to get the index of the control.
I need to know what entry (progress bar in this case) was clicked. In the function, I can even do things with a select progress bar using something like pb(x).value = some integer, but I'm trying to find out what 'X" is when the click event fires.
Here are some code snippets...
'Populate page 0 of tab control with progress bars
'TimerCount(int) = number of timer instances active in the database
For x = 0 To TimerCount
[code]....
EDIT: I figured out a work around using the 'name' property, but I would still like to know if what I asked about an index is possible.
View 6 Replies
Mar 1, 2010
This is a project I am working on written in Visual Basic, using Visual Studio 2005.I have a form (FrmMain) which contains a user control (CtrlDisplay). Within the user control (CtrlDisplay) is a list box which pulls information from a database. when you click on a button it checks another database to see if you have all the required components to build the object in the list box. If you dont have the parts, a dialog box (DiaAddToList) opens up to ask you if you would like to add the missing parts to your next order.
I had this all working perfectly when I was using forms and a MDI parent container. Now I am using a single form which swaps out user controls. the issue I am running in to is, the dialog box has the button "Add to next order", which is supposed to start routine to add the objects to the inventory. using forms, it was easy to do this, on DiaAddToList, under the sub when you click the add button, the code was FrmDisplay.AddList()
Now that I have switched it to user controls I tried to put CtrlDisplay.AddList(), and it is telling me "Reference to a non shared member requires an object reference". How do I reference the CtrlDisplay. It is already open and running on FrmMain. I tried to use "Imports.MyProject.CtrlDisplay" and that didnt work.
how I can reference this? It is starting to look like I will have to put the list boxes and routines into FrmMain, but that will end up with something like 200 boxes on one form, all overlapping and making it REAL confusing.
View 2 Replies
Aug 26, 2010
I have a GridView and, using a fairly common method, I'm using a FooterRow and TemplateFields to provide the missing insert ability. So far so good.The footer contains a TemplateField with a LinkButton to provide the postback that does the insertion. In the handler for the LinkButton's click, the Insert() method is called on the ObjectDataSource that the GridView is bound to. The ObjectDataSource's insert parameters are populated in the handler for its Inserting event. The code for all of this (abridged) looks like this:
Markup:
<asp:GridView ID="gvComplexRates" runat="server" AutoGenerateColumns="False"
DataKeyNames="id" DataSourceID="odsComplexMileageRates"
EnableModelValidation="True" ShowFooter="True">
<Columns>
[code]....
The first of these shows a tag of td. Which makes sense. The second shows text of "10" which is the content for the row above the footer.
View 2 Replies
Sep 24, 2010
I ran into a situation where FindControl was returning a control that wasn't a complete match of the Id I was searching by. There are two controls in the parentcontrol with similar Ids like: "MyControl" and "MyControlAlternate". When I call FindControl("MyControl") the control returned is "MyControlAlternate". I was wondering if anyone had any explaination why or thoughts as to what might be causing this problem. The way I got around this was implementing my own version of FindControl.
View 1 Replies
Jan 30, 2010
I have a MS Access database set up, with a Period field that has either values 1, 2, 3, 4 or 5. I retrieve these values using a database connection and I would like to reference a particular control based on what period was grabbed from the database.
Here's example code, pseudo of course.
TextBox(dr(3)).Text = dr(0)
dr(3) contains the period, and dr(0) contains the content I would like to put into the text box. I have these text boxes on my form: TextBox1, TextBox2, TextBox3, TextBox4 and TextBox5.
So if dr(3) contained 2 then I would want to reference TextBox2.
View 1 Replies
Aug 24, 2010
I'm trying to include a user control in an aspx page, it works fine, but my control does position itself where I want it and always appears at the very top of the page. Could it have something to do with the masterpage? I've tried registering the user control in the master page, but I don't know how to reference it in the content page.[code]
View 1 Replies
Jan 18, 2009
I've built my first usercontrol for use in a GPS Mapping forms app.
pic1 shows "panel1" containing some picturebox "tools" with a map(another panel containing a picturebox) underneath.
Pic2 shows that I dragged the map and the "tool" have not moved with the drag.
"panel1" also contains my usercontrol( this will show a transparent map scale). My usercontrol and all the "tools" definately have the same parent - ie "panel1".
If I resize the form to cause a re-paint of all the controls I get Pic3 - the red T bar (my usercontrol) will be the map scale.
Everything looks OK until I drag the map - the user control goes with the drag. Pic4 shows that the usercontrol image has been erased as it passed under the "tools".
I don't understand why the "tools" stay put and on top of the map and the usercontrol does not - even though they all have the same parent.
View 3 Replies
May 13, 2009
I've created a Custom Control, and I will be placing a large number of instances of that Custom Control on my xaml page. In working with that Custom Control in the VB Code Behind, how do I do the following?
How do I reference the name of the Custom Control (in my VB code) which was clicked with the MouseLeftButtonDown event? For example, if I have 10 instances of my Custom Control in xaml, each with a different x:name (say 1-10), when a particular instance is clicked, how can I see which one was clicked? I've tried a number of things including e.OriginalSource.Name (which returns the component within the control which was clicked and not the name of the instance of the control). My Custom Control consists of numerous parts and pieces (Rectangles, Lines, Text, etc). Each of these items is a part of my layer. In VB code, once I can reference a particular Control, how can I hide or change certain parts of that control (such as hiding a Line, and changing the text). Also, I need to modify more than just the control which was clicked, so I need to be able to access properties of all of the controls, not just what was clicked. For example, if I click Control instance Test1, I also need to modify Test2, Test3, and Test5 in some way.
Here is some test code I through together as part of a Silverlight project using MS Blend 2. My control is much larger, and I need 200 - 250 instances/copies of that custom control, so I really need to know which control instance/copy was clicked.
My UserControl:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
[Code].....
View 1 Replies
Jul 5, 2011
I have this database and I need to load it with a visual basic form in Visual Studio 2005.The database has 6 tables and they contain wrong data that I must filter when loading the database in the form.
A quick example:First table is Category, which has 3 fields (id, name, description). In one record I have 2a for id (a numeric only field) and in other record I have m1lk for name (a string only field).
When I click a button I load the database into a DataGridView control. How do I stop visual basic from loading into the DataGridView control those records that have invalid data (like in my example).
I have try with SQL queries using WHERE and LIKE, like in
SELECT IdCategoría, NombreCategoría, Descripción
FROM Categorías
WHERE (NombreCategoría LIKE '[!l]%') AND (IdCategoría LIKE '[!abcdefghijklmnñopqrstuvwxyz]')
but it's really difficult to filter things like Angel* and P3ter and Hood8, all at the same time..
View 1 Replies
Apr 1, 2010
I have a WebBrowser control in a VB.NET WinForms app. I am able to set the default printer from code and print without prompting the user. However, there is also a print button that shows the PrintDialog. If this action is done first the page will print.Then if I try to programmatically print later (again setting the default printer to some other printer) the it will print to the last printer selected in the PrintDialog box even though I am resetting the default and see the default printer being changed in Windows.It works fine unless ShowPrintDialog has a printer chosen first. Once that occurs it seems to always use that printer no matter what I do.
For Each strPrinter In PrinterSettings.InstalledPrinters
If strPrinter.Contains("My Printer") Then
wScript.SetDefaultPrinter(strPrinter)
[code]....
View 2 Replies
Aug 20, 2009
i m using this code but it gives beep on every press event i don't want this beep sound how can i?
[Code]...
View 1 Replies
Mar 18, 2009
I want the solution to move to specific control by providing Tab index through coding. Is there any way that i send tab key through coding and cursor move to or focus set to next control?
View 5 Replies
Apr 14, 2012
I have a user control that is created within a tab control every time a user creates a new tab, so each tab on a tab control contains a new instance of the user control. From within the user control I would like to get the parent tab's index, so that I can dynamically alter properties of the tab, such as the tab's title.
View 17 Replies
May 14, 2009
Private Sub minschanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAct1.TextChanged, txtAct2.TextChanged, txtact3.TextChanged, txtact4.TextChanged, txtact5.TextChanged
[Code]....
When one of the boxes is changed, I would like to find the index of the sender object that was changed in the txtmins() array.
View 3 Replies
Jul 7, 2011
let say a site has 2 forms: one search form and the other is a registration form[code]...
View 1 Replies
Nov 1, 2010
How to index files,folders,subfolders in selected folder and then inset information about them to treeview control?
View 3 Replies
Oct 9, 2009
I have a list view control that users can add items to but I need to be able to tell what item they have selected.
View 2 Replies
Jun 5, 2011
controls mainly an indexed picturebox control. In VB 4, 5 and 6, I could make a picturebox(0) indexed, but in VB Express 2010 I no longer see this option in the picturebox properties window how is this accomplished in VB Express 2010.
[Code]...
View 7 Replies
Jan 31, 2012
How do I reference txtCourse1.text and txtDept1.text using an index variable similar to to code below which does not work?
'two controls on the form
txtCourse1.text
txtDept1.Text
[code].....
View 2 Replies
Sep 29, 2010
In CSS, we have a Property called z-index, what is the same in Winfrom set for a Panel control to the "Z-Index?
View 1 Replies
Dec 29, 2010
Here's my situation: I have a control with motion graphics (for the sake of simplicity, a 'video player' control) in my project. Think of a PictureBox with constantly-changing images. In front of this will sit a second control (such as a second PictureBox of the same dimensions). The topmost PictureBox will be drawn to in its Paint event.
I need to draw very few elements, and the bottom control is updated much more frequently than I need for this drawing. So these elements are drawn to the topmost control. Think of a news broadcast, where they have live video in the background, with a news channel logo, news ticker, and sometimes gradient visible in front.
I'm trying to create that 'foreground' control, and the closest I believe I have gotten so far is the following:
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
[CODE]...
The 'Opacity' property in the code above is a sort of "scaling factor." The image drawn to the top control may, in different parts of the image, have any alpha value from full transparent to a full 255. This 'Opacity' property is applied to the entire image being drawn, scaling the alpha values of each pixel.
See the following pictures for description:
[URL]
[URL]
[URL]
View 9 Replies
Nov 29, 2011
I am using AjaxToolJit Tab Container and the problem is when i refreshes the page the default tab is set to 0 but i was in 4th tab when i refreshed the page.AutoPostBack=true
for a while but when i used UpdatePanel in the same page causes the same problem again.
View 1 Replies
Apr 9, 2010
I'm using an open source ribbon control that does not have click events for controls such as tabs, panels, etc.When I looked at the properties of the ribbon it does have the tabs, panels, etc. all in collections.I would like to change this (0) code so that I can get the index number of the control that the user clicks on. The tabs on this control are not like the regular tabs that come with Visual Studio. "Tabs" is a collection of Ribbon1.
Private Sub Ribbon1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ribbon1.Click
MessageBox.Show("You clicked on:" & Ribbon1.Tabs.Item(0).ToString)
End Sub
View 2 Replies
Jun 21, 2010
I have a program that adds controls on the fly to an auto-scroll panel. When the panel is scrolled (viewing the bottom of the panel for example) and a control is added, it looks like it is added assuming the top left corner of the panel is still at 0,0 when in fact it may be 0,500. To see what I am talking about, create an empty "Windows Forms Application" project and insert the below code into it.
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents btnAdd As System.Windows.Forms.Button
Dim ButtonCount As Integer
[code]......
View 4 Replies
Feb 28, 2010
How can to make control arrays in vb.net ? there is no INDEX property or Load method like VB6. so how i can do it ?
View 5 Replies
Mar 25, 2011
I want to set control position relative to other control so when i make one control hide then other control move up like this.
View 1 Replies
Dec 17, 2010
Usually I would just do Form.Control.Property but that doesn't work.It just seems overly complicated with public classes, etc.Is there a more simpler way to do this? I'm ready to throw in the towel and just use a global variable at this point.I have the form containing the control I want to reference, frmGenerate which has a textbox called txtCustomerNo.From this form through a button's click event I want to show another form, frmCustomers, and have that form reference the value in txtCustomerNo.
frmCustomers.ShowDialog()
View 6 Replies
Apr 6, 2011
In a Word automation project in Visual Basic 2005, I am trying to reference a bookmark in the bookmark collection using its index. However when I try to do this, the program aborts with the message that "The requested member of the collection does not exist". I am using the index so that I can refer to the subsequent member of the bookmark collection from the one matching my selection criteria. Here is a snippet of code which causes the error. In the listing below, the Debug line causes the error.
[Code]...
View 2 Replies