Forms :: Show UserControl As Form?

Aug 3, 2011

I have a class that inherits the UserControl class, the class creates its own graphics such as a title bar and what not. Is it possible to show this class as a form/it's own window?

Public Class CustomForm
Inherits System.Windows.Forms.UserControl
'create new instance, assign/declare vars here, blah blah

[Code]....

View 2 Replies


ADVERTISEMENT

Multiple Forms - Declare And Instantiate Second Form On Program Start - Use Button Simply To Show Form?

Jan 14, 2010

I have a program that uses two forms. The program opens to the Main form, and the user can navigate to the other form from the Main form through use of a button. Here's the way I've currently written it: When the Main form loads, it declares and instantiates the other form during the load procedure. When the user presses a button, the second form is displayed by means of the ShowDialog method. On the second form, there is a Return to Main Screen button which closes the second form, bringing the user back to the Main form.

So, here's the structure of the code:

Code:
Public Class frmMainForm

Dim frmSecondForm As New SecondForm

Private Sub btnSecondForm_Click(blah, blah, blah) Handles blah, blah, blah

[CODE]...

Here's my reasoning: Originally, I wrote the code so that a new instance of the second form was created every time the button was pressed. The problem was that whatever data was displayed on the second form, previously, was lost when the user returned to it a second time. Since the user would be switching back and forth between these forms, frequently, I needed that data to persist.

What is the best practice for accomplishing this:

1) Declare and instantiate the second form on program start, as I have done, and use the button simply to show the form?

2) Declare and instantiate the second form each time the button is pressed but maintain the variables on the Main form and pass them ByRef to a custom constructor for the second form? Is this even possible?

3) Something else?

View 5 Replies

.net - RaiseEvent From A UserControl That's Placed On A UserControl That's On A Form?

Jul 11, 2011

I have a Windows Form that contains a custom control container as a UserControl. For the sake of this question, this custom control container is called Dashboard. This container called Dashboard contains numerous other controls depending on their permissions. I need to raise events that are contained on these controls through the Dashboard control and over to the Windows Form.

How can I bubble up the event? I'm using VB.NET for this project, but can convert C# into VB.NET.Also, to complicate matters, the main Windows Form is a VB6 project. So, I'm using the InteropFormsToolkit to accomplish this.

View 1 Replies

Forms :: End Result To Show In Decimal Form?

Oct 21, 2009

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[Code]....

The end result is baffling me here are 2 examples when I debug

Mine: 640.1 * 49 = 31364.9
Debugger: 640.1 * 49 = 31360 ( not right needs to show the correct decimal )

Mine: .775 * 3 = 2.325
Debugger: .775 * 3 = 2.325 ( shows it perfectly???)

View 1 Replies

Forms :: Show Form And Disable Button?

Feb 23, 2009

i have uploaded 3 pics shows 3 diff forms.

1. BaseForm.( Includes 2 button, Buttons Text "Form1" and "Form2")

2. Form1. (Just inherited BaseForm)

3. Form2. (Just inherited BaseForm)

If the Button Form1 clicked then it shows Form1 disable Form1 button. and Hide BaseForm. same action for Button Form1.

When I click the Right Top Cross button then the Background BaseForm Still running. I want to close all form If I click cross.

View 6 Replies

Forms :: Show Form Random Location?

May 26, 2009

im working on a little project and i need my form1 to basically spam itself in random locations...

View 5 Replies

Forms :: Focus() Method Fails With Second Show Form?

Feb 7, 2010

I have a simple login field, which works fine with the exception of one quirk. The form is set up with the tab order to go to the UserID first and the Password text box second. This works fine when the form is used the first time, but when the form is used the second time the focus in placed in the Password field. If the form is used a third time, focus is moved the OK button, that is each time moves to the next tab order. I even tried to set the focus in the Load event as in Me.txtUserID.Focus(), but this doesn't change the behavior. Again, I should note that I close the form and not hide the form.

View 3 Replies

Show Usercontrol On Toolbox In Others Projects?

Oct 16, 2010

I can show usercontrol on toolbox in a its project but now i want to know how can i show that usercontrol on toolbox on others projects.

View 1 Replies

Forms :: Vb 2008 Express Form Wont Show Correctly

Aug 24, 2009

I have been working on a quite complex multiform solution.All of a sudden the start up form (in fact any form I designate to start up) loads, displays and operates fine.

But when I try and show a form using showdialog the form displays behind the original form and I can�t set focus to the ide to close it down. I have to use task manager or alt f4 while the form has the focus.

Calling different forms from this one gives the same result but other forms work fine. I don�t want to redo this form as Ive done a lot of work onit.The only thing I can think of that whist I was changing the startup form in the project propertied page (file>project>properties) I unchecked the �Enable applications framework checkbox.

View 1 Replies

Dequeue Data In Paint Event Of A UserControl To Show Continuously Moving Waveform?

May 11, 2011

Given this illustration and basic code, how do I dequeue and draw the data that has been inserted into the User Control's Preperty queue? The graph/chart will need to show anywhere from 1 to 120 seconds of data, with each second representing electrical waveform data that arrives each second with a variable amount of sample data..The timer interval will have to vary with the amount of incoming data so that it shows a continuously moving waveform from right to left and the rate of drawing keeps up with the amount of data arriving. (so the queue doesn't get backed up)

View 7 Replies

How To Call Usercontrol In Forms

Jun 24, 2009

Am doing windows application in vb.net,then created the user control but i don know how to call the usercontrol in forms.

View 3 Replies

Forms :: Pass UserControl As An Argument?

Sep 8, 2010

I've got several user controls and every time I add them, I post this

Dim uc As New ucTemplates ' 'ucTemplates' is the name of the actual user contrll
gbControls.Controls.Clear()
gbControls.Controls.Add(uc)

So, I'd like to create a sub that does the same thing, passing the usercontrol as an argument

Private Sub AddUC(myControl as UserControl)
gbControls.Controls.Clear()
gbControls.Controls.Add(myControl)
End Sub

But - when I try:
addUC(ucTemplates)

I get an error that ucTemplates is a type and cannot be used as an expression
I can get it working if I add the Dim uc As New before the addUC - but I'd rather have it so I only repeat one line, not 2

View 1 Replies

Forms :: Creating Usercontrol Which Gets Input And Display The Numbers?

Jul 12, 2009

Am working on a project like a office automation. The problem am displaying the balance amount using lables.But i want to display the numbers like we see in calculators...

One way to do that creating usercontrol which gets input and display the numbers.

View 3 Replies

Forms :: Process MainWindowHandle - Simple GUI Form To Hide / Show / Minimize / Terminate / Force Terminate

Sep 11, 2011

I have a simple GUI form to hide / show / minimize / terminate / force terminate Processes. i can do all well but for show and hide i need the MainWindowHandle to show or hide it

So here is hide process code:

Dim Proc As New Process = Process.GetProcessesById(List.SelectedRows(0).Cells(1))
Dim hwnd = Proc.MainWindowHandle
ShowWindow(hwnd,0)

If i try the same with show code:

Dim Proc As New Process = Process.GetProcessesById(List.SelectedRows(0).Cells(1))
Dim hwnd = Proc.MainWindowHandle
ShowWindow(hwnd,9)

The MainWindowHandle become 0 cuz its hidden is there is any other way to get the MainWindowHandle of Process ?

View 6 Replies

Forms :: Change A Property On Form - Doesn't Show That Change

Jan 13, 2010

I'm working on a simple base form in which all the other forms in the project will inherit. This base form only adds 5 properties (at the moment) dealing with painting a gradient background. The problem I'm facing right now is when I change a property on Form1 (the test form) and click run it doesn't show that change. I also checked the .designer.vb file and when I make a change it's not added to the code behind file, I'm at a loss right now to why.

[Code]...

View 5 Replies

.net - Write A .NETCF Partial Class To Extend System.Windows.Forms.UserControl?

May 28, 2010

I'm writing a .NET CF (VBNET 2008 3.5 SP1) application, which has one master form, and it dynamically loads specific UserControls based on menu click, in a sort of framework idea. There are certain methods and properties these controls all need to work within the app. Right now I am doing this as an Interface, but this is aggravating as all get up, because some of the methods are optional, and yet I MUST implement them by the nature of interfaces.

[Code]...

View 1 Replies

Manage The Same Form Through A Usercontrol On The Control Form?

Jul 11, 2011

I have a form that I am managing, works well, but now I am thinking about using a usercontrol embedded in the control form. Is it possible to manage the same form through an usercontrol on the control form? Dont think I phrased that right, say if you had form1 that loads(manages) form2, which I can do, how can I manage form2 with an usercontrol embedded in form1? Is this possible?

View 1 Replies

C# :: Call Function From UserControl On ASPX From UserControl On MasterPage?

Jan 31, 2011

I have MainLayout.master that has UC_Menu.ascx on it. I have a page named Customer.aspx that uses MainLayout.master. Customer.aspx also contains a UserControl named UC_Details.ascx.How can I have UC_Menu.ascx call a function that is in UC_Details.ascx with this scenario?

View 3 Replies

Communicating Form.vb And UserControl.vb

Jul 25, 2009

I have VB.net Simple application with form1.vb , UserControl1.vb and a simple Dataset with few records included. In my UserControl1.vb I'll added a Bound DataGridView1 with Products Datasource. My question is.. How can i filter the Products table from UserControl1.vb? The Filter Value ("ProdID") is from Form1.vb with textbox1(receive the value.). here is my Form1 code

[Code]...

View 4 Replies

Embed UserControl In A Form?

Feb 19, 2010

What is the code to embed a UserControl in a Form?

View 4 Replies

Simple Form With A Usercontrol

Aug 25, 2010

Description of problem: I have a simple form with a usercontrol on it. There is a drop down box with a list of departments in it and a button, this is all in the usercontrol. I pick a department then press the button to view the employees in a listview for the department picked. All worked fine until I moved the code for drop down and button into the usercontrol from the form.

The data is taken from oracle database express 10G edition and I am using a cursor package (CP) and I pass parameters from the code to the oracle procedure within the CP. One of these parameters is the selected department from the drop down list (which I have picked) and my code does not seem to be picking up this parameter, it keps saying that the bold bit of code below is nothing:

myCmd.Parameters.Add(New OracleParameter("n_dept", OracleDbType.Varchar2)).Value = usr1.cmbDepartments.SelectedItem

Everything else seems to be fine. Because it is not picking up the selected item then the dr.read (no data by the looks of it) is false and it just falls out without populating any employees for that dept in the listview.

Does anyone care to take a stab at suggesting what might be wrong? Why won't it pick up the selected item in the user control I have just picked it in?

View 11 Replies

VS 2010 : Controlling Usercontrol From Form?

Jul 31, 2010

how do you control USERCONTROL button1_click event from form's button2_click event?

button 1 = hidden button on usercontrol1
button2 = visible button on form1
form1.button2 should click usercontrol.button1

View 4 Replies

Show Information From A Datagrid Cell To Show Up In A Text Box In Another Form

Jun 8, 2011

how do you show information from a datagrid cell to show up in a text box in another form, this is for a college project.

View 1 Replies

UserControl Access To Public Properties In Another UserControl?

Jun 12, 2011

I have a Windows Form frmMain() holding seven more-or-less unrelated UserControls, ucFlopsy", "ucMopsy", "ucCottontail", etc...I say "more-or-less" because each of the seven UC has three similar public read/write properties:

IsLocked (a boolean indicating if the following two properties are "Locked")
IsLockedID (if IsLocked=True then IsLockedID is an integer)
IsLockedName (if IsLocked=True then IsLockedName is a string)

[code].....

View 1 Replies

.net - WinForms UserControl Version Of Form.Closing

Apr 25, 2012

I've got an MDI form with child forms that I'd like to refactor to a single form with a tab control containing child controls, in order to move away from MDI clunkiness. When looking at converting the child forms into child controls (or usercontrols), I do see that I'd lose the FormClosing event, which some of the child forms use.

I can override Dispose to handle some of the functionality, but in some cases I'd like to cancel the closing event. Also, I'd like this event to be called before the control is closed even when the form it's on isn't closing, so wiring the control to the form's closing event isn't an option.

[Code]...

View 2 Replies

Devexpress - Making A Call From One Usercontrol To Another Form

Aug 28, 2010

I have a tabcontrol that creates tab pages from a "User Control" I created (a separate form in vb.net) using this code: (MainTab is the separate user control I created which has text boxes etc in it)

Dim tmpTab As New MainTab
myTabControl.TabPages.Add()
Dim tmpTabCount As Integer = myTabControl.TabPages.Count
myTabControl.TabPages.Item(tmpTabCount - 1).Controls.Add(tmpTab)
myTabControl.TabPages.Item(tmpTabCount - 1).Text = "Untitled"

I'm using the devexpress xtratab control so the code might look a bit different than the default vb.net tab control.

Now in my MainTab user control file file, I can't for the life of me figure out how to call a control in the form1 where the xtra tab control is placed on. "Me.Parent.Dispose" works for closing the tab when executed via the MainTab control, but that's as far as I can get for communicating with the parent from.

I'm not sure if I have to reference something in the MainTab user control or what in order to communicate with any objects on the default form1.

View 1 Replies

UserControl Disappears From Form Design View On Run?

Jul 24, 2009

I have a custom UserControl that I am hosting inside a FlowLayoutPanel. Each time that I run the application the control will disappear off the hosting form's design view. I have to close the form's design view and then reopen it each time. The control is not getting removed in any way, just isn't being shown.

Edit, alright this got a bit weirder. Only the first usercontrol that I put into the FlowLayoutPanel disappears. This problem also happens on a project Build and Rebuild.

View 8 Replies

UserControl MouseLeave Event Not Firing On Form?

Apr 16, 2012

I created a little usercontrol that looks similar to Visual Studios toolbox. It works great in the user control project, but when I import it to a form the MouseLeave Event doesn't work. The MouseEnter event works fine however. Any idea why only the MouseLeave event doesnt work? I did notice that I have to use the Panel controls MouseLeave, MouseEnter events for things to work correctly. The Usercontrol Mouseleave and Mouseenter didn't work at all.

Public Class vsStyleToolBox
Public isPinned As Boolean = False
Public isShowing As Boolean = False

[code]....

View 2 Replies

VB Calling Parent Form Methods In A Usercontrol

Sep 29, 2010

control that contains a button. the user control is placed on my main form. when the button on the user control is clicked I need to to call a method that is located in the mainform.vb

View 2 Replies

VB Calling Parent Form's Methods In A Usercontrol?

Aug 9, 2009

control that contains a button. the user control is placed on my main form. when the button on the user control is clicked I need to to call a method that is located in the

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved