Wpf - Access Controls From MainWindow?
Feb 5, 2012
I have a text box in the MainWindow. I was wondering how I can access it from another window. I tried declaring an instance of the MainWindow but it doesn't work. Say I want to set the text in the MainWindow to something, in SecondWindow. How can I do that?
View 1 Replies
ADVERTISEMENT
Jan 20, 2009
is it possible to create VB .Net apps without a mainwindow?I want to call my VB app from another app. It will just take a few files, and input them in a database. So, I need no window.
View 1 Replies
Feb 2, 2011
I have a program that is getting pretty big and it is a pain to find everything through all the functions and classes. I am trying to break it up into other files based on their method. Some of these functions have calls to others in the main class. I changed most my functions from private to public to access this. I had problems calling certain code created windows so importing mainwindow helped that. My last problem is editing the mainwindow ui from one of the module files. I want to make sure im on the right page before i continue breaking it up. My only guess is that anything they updates the ui should be left on the main class.
View 2 Replies
Jun 18, 2012
I am new to WPF and the MVVM design pattern this month, and more than a little out of practice in general. To learn, I've been playing around with textboxes, rectangles, and ways to display them in a window. I began with Ashley Davis' excellent "Simple Drag Selection in WPF" tutorial, which walks through creating a view model for a collection of rectangles, binding a listbox to said collection, and styling the listbox with a canvas, creating a data template for the rectangles, as well as basic "rubber band" selection logic.
I have since built on this tutorial to improve the drag selection so that it behaves much more like selection does in windows explorer, and to allow resizing the rectangles from the corners or edges.All was well until I changed the MainWindow.xaml in an effort to include a column on the side for various buttons and controls, thus moving the "editor surface" grid from inside a 1x1 grid on the main window to a column of a 1x2 grid, moving the data template to the grid's resources (since it will be the only element in the window that needs it). As soon as I did this, subroutines that I wrote which interact with the listbox started misbehaving--rubber band selection no longer works. There's no visual indication that listbox items are being selected (they were highlighted previously), and interrogating listBox.SelectedItems.Count after a drag-selection mouseUp event returns a zero.
After some experimentation, reading many questions on this site and sections of my WPF Unleashed book, and going over the msdn databinding overview, as of this morning I still cannot find my mistake(s). I believe it is a data binding mistake or incorrect data context.Some details about the view models involved:
DataFieldViewModel
...implements INotifyPropertyChanged and exposes properties for its (in this case a rectangle and a textbox) X,Y position, width, height, visibility, and selection status (a way to track it across several rubber band selection operations)
PageViewModel
...implements INotifyPropertyChanged, and has among other things an ObservableCollection of type DataFieldViewModel, called DataFields, and exposes it as a ReadOnly Property.Here's a look at MainWindow.xaml.vb and one of the broken subs:
Namespace EditorUI
'
' The main window of the editor.
[code]....
View 1 Replies
May 13, 2009
I've been building controls for many years professionally and personally, but even back in VB6 days I just could not work this out. After all this time I remembered about it again.If I create a usercontrol/containercontrol and add one or more controls to the controls surface, I just cannot figure out how to access the controls at design time.
View 4 Replies
Aug 30, 2011
I am looking for a way to make my app running in a single instance mode and showing the MainWindow of the first instance when another instance is launched.I do a quick search on the internet but I did'nt find anything to open the MainWindow of the first instance or it was for Windows Form not for WPF.
View 1 Replies
Mar 19, 2010
I'm creating a reporting application, and our customers are going to need to generate some pretty big reports which require quite a bit of memory. Ive been in a re-factoring mood lately, so I was wondering what the best way to access the properties of another open form would be(The reporting viewer opens in a new form.) So far I have:
Dim form As MainSelections
form = My.Application.OpenForms(2)
yay or nay.
*Edit - I should probably mention that what I need is a label, two date time pickers, 5 datagridviews and a few datasets. Those cotrols have the info I use for my parameters
View 2 Replies
Oct 11, 2010
I am working with VS2005 using VB.net I have two project (Project A, Project B), project A is the startup project with form1, while project B is dependent on project A, both under the same solution. I have established the project dependencies so that Project B is now Dependent on Project A. Also i added references to both projects to each other so that i can access controls on Project B forms through Project A (Like changing the value of a textbox on B through A). My problem is that whie trying to access controls on Project B Forms it doesnot show up.
[Code]...
View 10 Replies
Aug 9, 2010
I am working on VB.NETPresent i am working on Dynamic Controls.As per below sending my Code ...... I was Created....First Step: i was Created CheckBox Controls Dynamically in the loop.Second Step: i was Created One more CheckBox Control name called 'AllProjects".
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn.ConnectionString = ("Provider=Microsoft.jet.OLEDB.4.0;Data
[code].....
View 36 Replies
Jul 23, 2010
I have added a report to my form.how I can access the controls on the report? Say I want to access the control on the form then I would simply reference the control in code i.e. Form1.Textbox1.Text = "Hello", but I cant see my reports in the VB when I look thought the intelisence.
View 1 Replies
Jul 1, 2007
I am having some problems adding controls at runtime, or I guess I should say accessing the controls after adding them.The application starts off with a tab control named "tabIncidents" and one tab for an incident information. The user can click on a button to add a client. When the button is pressed a second tab is added to "tabIncidents" named "Clients." On the newly created "Clients" tab another tabcontrol is added named "tabClients" and we create a tab named "Client". Multiple "Client" tabs can be created on this tabcontrol. Each "Client" tab gets a usercontrol added named "clientInformation" which has name and address textboxes.
So basically it is ...
TabIncidents.tabFirstTab (already exists)
TabIncidents.Clients (new tab added at runtime if user clicks a button)
TabIncidents.Clients.tabClients (new tabcontrol on the new tab)
[code]....
View 17 Replies
Sep 11, 2010
I'm trying to update the UI from a background thread, but the method I'm using at the moment isn't working. From what I've been reading, the method I'm using should work, but it isn't.[code]...
View 8 Replies
Feb 7, 2011
I have a couple user controls that are loaded by a Select Case statement. However, in the behind code file for the main page that loads these controls, none of the asp controls show up in intellisense. I had a feeling it's because the controls are loaded conditionally. My question is what is the best way to solve this?
1) Load the controls and do a Select Case in the behind code to make them hidden or not.
2) Is there a way to say (psuedocode): LoadUserControl("UserControl1").Controls("tbTest").Text = ""
3) How can I pass a dataset to the User Control file?
4) Any other ideas?[code]
View 1 Replies
Jun 10, 2012
Create a web browser with tabs and I want to add a "Open in a new Link" Button with a Custom Menu .
The problem is I'm trying to use a Dynamic Control(Webbrowser) created in a class from a local sub (A picture box) on the event click . But i get this error [code]....
View 2 Replies
Aug 27, 2010
Does anyone know how I can access the FontDialog's controls collection? I would like to disable the Font Style ListBox, set the Font Style's TextBox to readonly and disable the UnderLine and StrikeOut CheckBoxes.
View 3 Replies
Apr 23, 2011
How do I do something like this.[code]...
This is inside the Module separate from Form1 class as you can see right off the bat it's not a class and there is no reference to Form1.. how do I access Form1 without passing reference to make factory modules work like this.
View 1 Replies
Jun 8, 2009
I'm trying to fill a web ASPX form thru a VB.NET desktop program using the IE control SHDocVw.InternetExplorerSo far i can set all the textfields that i have to set and click the send button, but i have a small problem: i have to execute a "validation" java script code that is on the ASPX page before clicking the SUBMIT button.
Here's my code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[code]....
View 2 Replies
Jul 22, 2010
Recently i worked on a VB. I have to know how can create controls Dynamically on the run time and how can access these controls on the runtime??
Ex: I want to Create 10 checkboxes at runtime. After creating Checkboxes Dynamically how can i access these Checkboxes?? like i create Checkbox Called "chkAll" , If i check "ChkAll" checkbox then all Dynamic Checkboxes should be Check otherwise UnCheck?
View 13 Replies
Oct 16, 2009
I have created a usercontrol that contains two rectangle shapes to create a unique button effect and a rounded-corner rectangle shape serving as a border to provide a look similar to a group box. It also contains two labels, one for use with a Text property of the control and the other to indicate the status of expansion of the control. The control is designed to collapse itself when the "button" is clicked leaving only the "button" visible. Clicking it again toggles this affect. I've dubbed it an ExpansionBar. It is also designed to be a container control so that I can add controls to it and allow these to disappear when the bottom portion collapses. This seems to work great! The problem is that the controls contained in this usercontrol cannot be accessed during runtime. In other words, I can add a checkbox to it and it will disappear correctly when the control collapses, but I can't select the checkbox to check it... same thing with any other controls, you can see, but can't touch.
View 2 Replies
Aug 24, 2009
Here is my setup:
Form1.vb - contains RichTextBox1 and BackgroundWorker1, which calls a the Control module.
Control.vb - calls Display module.
Display.vb - calls Form1.SetTextBoxText("text here").[code]...
My observations: When the Display module calls SetTextBoxText, InvokedRequired's is false. Also, if the BackgroundWorker1 (which is in Form1.vb) calls SetTextBoxText, it works. But if BackgroundWorker1 calls a module that calls SetTextBoxText, it doesn't work.
View 4 Replies
Jul 30, 2011
I am trying to write general function to set the attributes of the command button and want to access this function from any forms.But I am getting error in this function.[code]
View 1 Replies
Sep 16, 2011
I have a form called form1 which has a thread that runs a sub from a module.[code]...
Well from the module, there's a part where I have to update controls on the form1. Whenever I try doing it, it updates the value, but not the design. For example I write a delegate which makes label1.text = "111", while debugging, label1.text becomes 111, but it does not show it updated on the form design, it just stays at its default value.
View 4 Replies
Dec 18, 2010
I have a checkbox and a panel inside of a FormView control, and I need to access them from the code behind in order to use the checkbox to determine whether or not the panel is visible. This is the code that I originally used, but since I put the controls inside of the FormView, it no longer works.
Protected Sub checkGenEd_CheckedChanged(ByVal sender As Object, _
ByVal e As System.EventArgs)
If checkGenEd.Checked = True Then
[Code]....
There aren't any errors anymore, but nothing happens when I click the checkbox. I think there needs to be some kind of event to trigger it but I don't know how you can put an event handler inside of an event handler.
View 2 Replies
Jan 24, 2012
When I click the "Edit" button, and it switches to the EditItemTemplate view on the right, I want to prefill the Textbox and select the corresponding option in the DropDownList. [code]...
View 2 Replies
Dec 6, 2011
I have a form named VBProject It has two TextBoxes and one custom control named MyControl which is created in another project.MyControl's project has a form inside, named Form3. When My control is loaded it needs to find all controls in my VBProject and add them into a listbox which is in Form3. Then Show the Form3. In the end ListView need to shows name and text of textboxes but it shows nothing. Here are my codes:
MyControl's Load_Event:
Dim i As Integer = 0
MessageBox.Show("Control Count:" + Me.Controls.Count.ToString)
For Each MyObject In Me.Controls
If TypeOf MyObject Is TextBox Then
[code]...
View 1 Replies
Apr 5, 2010
Private Sub NamesControl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmbo1.Items.Clear()
[Code].....
How do I access parent form or container's other controls?
View 2 Replies
Jan 23, 2012
I have a PlayStation USB controller and want to discover how to test the buttons and controls on the device from vb.net. Is there documentation anywhere on how to get info from a usb controller? I'm not even sure which department or category this falls
View 5 Replies
Jan 11, 2012
How to access controls from class files in app code?
Markup:
<%@ Page Language="vb" AutoEventWireup="false" Inherits="shoppingCart1.ShoppingPage" CodeFile="ShoppingPage.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
[Code]...
View 2 Replies
May 20, 2011
I'm using a repeater ListOfArticles and have controls inside it like ddlSizes and btnSelectArticle. Normally you can just double click the control and in the aspx.vb page you can specify an action. I have heard something about Findcontrol, but can't figure out or find much information that I understand. I don't want to sound like an ass, but I would really prefer help for the aspx.vb page and not in C# or Javascript.
An example of what I'm trying to do is, once you've clicked btnSelectArticle the label lblSelection receives the following values Amount: txtAmount - Size: ddlSizes.SelectedValue.
<asp:Repeater ID="rptListOfArticles" runat="server" DataSourceID="objdsArticleList">
<asp:DropDownList ID="ddlSizes" runat="server" AutoPostBack="True"
[Code]....
View 2 Replies
Jan 17, 2012
I have a few bound data controls on a form. However, there are certain data fields in the same table from which this data is coming from which I would like to be able to access in memory but which is not bound to a control. I have tried looking through the properties of my datanavigator, my dataadapter and my databindingsource and can't seem to find out how to sort this.
In simple terms, I have a data navigator to iterate through various fields in my dataset. I want to be able to access to the contactID of the currently visible / selected contact. The contact ID exists in the data source but I do not want to show it, just access it. How do I do so without issuing a manual SQL call to the database again?
View 1 Replies