Forms :: Run A Custom Public Procedure To An ActiveMDIChild Form?

Jan 31, 2009

my problem is that i have an MDI Parent form. it has lots of child forms. on my MDI Form i have the toolbar buttons Add, Delete and Save.all or most of the child forms, i created a custom public procedure Sub AddNew, Sub Delete and Sub Save.what i'm trying to do is when i click the AddNew in the MDI Form, it will run the custom public Sub AddNew of the currently ActiveMDIForm. i have tried...

DirectCast(Me.ActiveMdiChild, Form2.AddNew()
but i'm getting an error "Unable to cast object of type 'Form1' to type 'Form2'" if the currently ActiveMDIChild is not Form2.

[code].....

View 5 Replies


ADVERTISEMENT

Custom DataGridViewColumn - Error: 'Public Event ItemCheck(sender As Object, E As System.Windows.Forms.ItemCheckEventArgs)'

Jan 19, 2012

following code from c# to visual basic, and I'm coming up with the following error: 'Public Event ItemCheck(sender As Object, e As System.Windows.Forms.ItemCheckEventArgs)' as an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

[Code]...

View 8 Replies

Use Instance Or Form Name When Addressing Public Variables Between Forms?

Nov 17, 2009

In vb.net, you can address a public variable from another form using the form name along with the variable.

form2.show
form2.k = 3

However, if you use a form variable to show an instance of the form, you must use that variable name to address the public variable. Two instances of the same form are displayed in the following example. The public variable k is assigned a value of 3 only in the first instance of the form, the one from form2.show. frm.k can be used to assign a value to the other form.

dim frm as new form2
form2.show
frm.show
form2.k = 3

Assuming only one instance of the form is shown in the application, is it reliable to address a public variable using the form name (form2.k), or is it better to show the form with a form variable and use that to refer to the instance of the form (frm.k)? Would the same answer apply to a property as well as a public variable?

View 2 Replies

Call A Public Sub Procedure From A "ParentForm" If We Have Dim ParentForm As Form = CurrentTextBox.Parent?

Sep 20, 2009

I have a Visual Basic form with a public sub procedure called xecute_Public_User_Defined_Sub_Procedure.I tried to call the sub procedure from the "ParentForm" below but could not.

Dim ParentForm As Form = CurrentTextBox.Parent
If ParentForm IsNot Nothing Then
ParentForm.Execute_Public_User_Defined_Sub_Procedure()

[code].....

View 1 Replies

Creating Public Class For Handling Stored Procedure

Feb 4, 2010

'I am trying to create a public class for handling stored procedures
'Class declarations
'1) Mode (delete, insert, edit)
'2) Stored procedure Name (sp_insert_MyTable, sp_delete_MyTable)
'3) Stored Procedure Parameter Count ( 10 or 5 depends) (need to avoid this)
'4) Stored Procedure Parameters (Here I need to declare as Structure, use dynamic array)
'5) How I can call this in Form
'My Study Code, Please correct it...

Public Class clsTest
Public Structure spParameters
Public varPara As String
Public varDataType As String
Public varDatatypeSize As Integer
[Code] .....

View 1 Replies

Forms :: Generating Custom Code For A Windows Form From User Input

Mar 30, 2009

I am trying to figure out how to generate code from user input. In Visual Studio 2008, Visual Basic.My script always begins with:function Init (Quest)Then from here a user would input a quest name, type and zone in a interface using windows forms.[code]I would also like to have these available on the UI but wont generate unless a user checks a box to add them or there is a box already for them but wont step into the code unless the user enters something into the box.Is there anyone that can explain how I would go about doing this. Or maybe some kind of visual studio plugin that will help me out.

View 2 Replies

Passing Data Between Forms Without Any Public Methods Or Properties On The Forms

Dec 28, 2009

Passing data between forms without any public methods or properties on the forms. everything but the "Controller" class, which I would like you furnish. I just changed the title from "Intermediate" to "Beginner" This solution is an example of the Observer Pattern. The "Controller" class is the "observed" class, which in this case means it publishes events.

' File Definitions.vb

Public Delegate Sub MessageDelegate(ByVal sender As Object, ByVal e As MessageEventArgs)

Public Class MessageEventArgs : Inherits EventArgs
Public Message As String

[CODE]...

The program should initially display Form1, and Form2. Clicking of the button on either form will modify the Title Text of both forms. I think that you will find the final end result to be pretty neat, as it works with any number of open forms not just two. I think asking for the Controller class is easier than asking for the code in the forms. My solution for Controller class has 7 lines of content, 9 lines if you include Class, EndClass. A minimal solution could achieved with only 4 lines of content, but it would a textbook example of bad programming.

View 12 Replies

Custom Class With A Public Property String Array?

Jan 5, 2010

I am trying to create a property of type string array (if this is possible).....and I seem to be lost.

I tried the following, but it says "String cannot be converted to '1-dimensional array of string'" at the return

Private _strZipList As String()
Public Property strZipList(ByVal i As Integer) As String()
Get

[Code].....

View 10 Replies

Why Use A Public Property Instead Of A Function To Expose A Custom Collection<T>

Jul 6, 2009

During a code review I looked at set of repository classes (in vb.net). I am used to seeing these repository classes full of functions that return collections (among other things) of your domain objects. However, this repository had 1 public property and 1 private variable that looked something like this:

Private _item as Collection (of Customer)
Public Item as Collection (of Customer)
Get...
Set...

In the "Get", there is code that gets a the Customers from the DAL and loads it in the private _item. What would the benefits be in using a property (customerRepository.Item) instead of plain old function (customerRepository.GetAllCustomers)? The "Property" way looks odd to me but odd doesn't always mean wrong.

View 3 Replies

Forms :: Properly Set A Public Variable?

Oct 31, 2010

I want al(InitialStrength.Text) to be set as the variable iST so I'm typing this at the top of the page before all my subs:

Public Class CharacterSheet
Public iST As Integer = Val(InitialStrength.Text)

[code]....

but every time I do that and try to compile without even using the variabe, I get this error: "An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."

View 5 Replies

Winforms - Friend Vs. Public For .net Forms?

Jan 19, 2010

Is it better to use friend or public forms in vb.net? What are the advantages of each?I notice when you import a vb6 project, the forms come in as friend, but when you add a new form in vb.net it is public. I have not seen any difference in the way they work, though, so I must be missing something.

View 3 Replies

Change A Forms Access Modifier To Public?

Jun 11, 2010

i want to now how to change the access modifier of a form so that it is publiv ind=stead of friend.

View 2 Replies

Make A Variable Public To All Forms Within The Application?

Jun 9, 2011

how to make a variable public to all forms within the application.Eg

Public MyPath = "C:"

can do for one form but not all

View 3 Replies

Public Sub Show (as Owner System.windows.forms.iwin32window) Error

Aug 23, 2009

public sub show(as owner system.windows.forms.iwin32window) error

View 1 Replies

Forms :: Event Procedure From Combo Box Drop-Down?

Jul 24, 2011

I've created a form to handle "frequently asked questions". In the form I have five Drop-Down Combo Boxes and I want the user to be able to select one of the questions listed in the drop down boxes and have it return a "message box" with the answer to the question. Naturally I'll have different "answers" for each question, but my initial efforts have me getting my message box as soon as I click on the drop-down arrow itself, and I don't want that triggered until I click on the specific question.

View 5 Replies

VB - Run Procedure (Sub) On First Form Then Stop In Middle Of It And Wait For Input On The Second Form

Mar 23, 2011

In VB.NET I've got two forms, on first one I have button, on second - two textboxes and "OK" button. I want to run procedure (Sub) on first form, then stop in the middle of it and wait for input on the second form. After that i want to process the data received from second form.

It looks something like this:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Open form2 for input

[CODE]...

The question is how to call the Form2 so that procedure is stoped till the second form is closed?

View 3 Replies

Warning 1 Namespace Or Type Specified In The Imports 'System.Windows.Forms' Doesn't Contain Any Public Member Or Cannot Be Found

Mar 14, 2010

When trying to compile my newly created ClassLibrary class 'Validator' that validates entries made into TextBoxs or MaskedTextBoxs, I get the following error:

Warning 1 Namespace or type specified in the Imports 'System.Windows.Forms' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:Users erryDocumentsVisual Studio 2008ProjectsMillerClassLibMillerClassLibValidator.vb 1 9 MillerClassLib.

Following is the first part of code in the class:

Imports

System.Windows.Forms
Public
Class Validator

[code]....

What can I do to resolve this problem? The classes in this class library will be used to validate forms data input in a number of varied projects.

View 2 Replies

Can't Use A Public Sub In Another Form

Aug 28, 2011

I can't use a public sub in another form...

Here is what I'm doing:

I created a button called BTest and a TextBox called TBTest.

When I press BTest, it writes on TBTest "BTest Worked!".

PS: The button BForm2 is just for Form's change.

Form 1
Public Class Form1
Private Sub BForm2_Click(ByVal sender As System.Object, ByVal e As

[Code]....

View 3 Replies

Run PUBLIC SUB From Another Form?

Jun 4, 2009

I have a couple of PUBLIC SUB's on my Form1. Is there a way that I can execute them on Form1 through another Form / Button-click? I am using a Dialog1.ShowDialog() for configuring some settings for my application. Now, I have most stuff on my Form1 set / loaded via PUBLIC SUB's (for example THEME SETTINGS, DROPDOWN LIST values and so on), and if I change something in the Dialog1 this Subs need to be executed again ...

Before my explanation gets too complicate, here a sample with a simple SUB:

Asume you have a Form1 with a Button1. On Button1Click a Dialog1.ShowDialog will be executed. In addition you have the following PUBLIC SUB on Form1:

Public Sub ShowMessage()
MessageBox.Show("Hello World!", "Message:", MessageBoxButtons.OK, MessageBoxIcon.Hand)
End Sub

How could I execute this Sub on Form1 from Dialog1 (maybe on a ButtonClick event)?

View 12 Replies

Windows Forms Textbox Stored Procedure Code Injection?

Jul 12, 2011

I have the following sub in a windows form:

Private Sub BTNC_storeclientdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNC_storeclientdata.Click
' Update Clientdata[code].....

This performs an update in the SQL Database via a stored procedure. When I add '; insert into codeinjection(test) values ('CodeInjected!'); select ' in the last textbox (TBC_phone.Text) the value 'codeinjdected' is inserted into the table codeinjection as well. How can I avoid this?

View 7 Replies

Pass Form Name To Public Sub?

Jan 14, 2012

My plan is depending on the users screen resolution a different form will open. Thats all fine and works hunky dory.

However, the form pulls code from a public sub and updates fields on the form based from the public sub[code]...

My problem is how can I change the FORM1024x768 to say FORM1366x768 if the users screen resolution determines a different form is chosen. I need something like[code]...

View 7 Replies

Asp.net - Access A Module Or A Public Class With Public Shared Members From Inline Vb Code <% .. %>?

Feb 10, 2011

I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.

View 2 Replies

Attempting To Make A Form Public

Jul 12, 2011

I am attempting to make a form public. I've start out with this class:[code]I can see the stupid form thru intellisense, but when this code is run I'm getting a null reference exception. I believe this is because the stupid form has not been initialized. I thought that placing 'new' in my class definition would initialize the form.

View 4 Replies

Cant Access Public Variables From Another Form?

Aug 25, 2010

I have a string on my main form called String1. When I open another form, I need access to this value. In the form I open, I have always done something like:Dim NewString as String = Main.String1

This has worked in the past. Well, I ended up renaming my forms (from Form1 to Main) in the property window and it now when I type the above code, it does not list Main as a form. Nothing that I renamed seems to exist now.

View 2 Replies

Public Function With Form Scope?

May 17, 2012

I have a Function for checking the input in a textbox and only allowing Numeric & Backspace; everything works fine so far. My form is for financials and it has about 20 textboxes; they all receive Numeric only data; there is NO alpha data on the entire form required. Note in the snippet below that I don't even need a decimal point as well.

Is there a way to handle ALL textboxes on this form without having to place the Function call in each textbox KeyPress event. took a long (5 year) hiatus from developing VB6

Public Function TrapKey(ByVal KCode As String) As Boolean
If (KCode >= 48 And KCode <= 57) Or KCode = 8 Then
TrapKey = False

[Code].....

View 5 Replies

Public Variable Not Delared In Other Form

Aug 9, 2010

I defined a variable in a form with

Then I want to check that variable in an other Form using[code]....

View 3 Replies

VS 2010 - Calling Public Sub On Another Form

Aug 26, 2011

I'm having trouble on calling a public sub on another form. Here is the sub:
Public Sub BOTAO_NUMERICO(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles N0.Click, N1.Click, N2.Click, N3.Click, N4.Click, N5.Click, N6.Click, N7.Click, N8.Click, N9.Click
Dim Res_ant As String
Dim Res_atu As Double
If (Res <> 0) Then
[Code] .....

On form Normal, BOTAO_NUMERICO works fine, but on Cientifica it don't.
OBS: All objects on both forms are the same, with same name.

View 2 Replies

Declare A Public Param For Public Class Form1?

Apr 7, 2011

Imports System
Imports System.Threading
Imports System.ComponentModel[code]....

how to declare "smsport" on class smscomms as public so that it can be access in class form1 or button1_click event.

View 5 Replies

Declare A Public Variable And A Public Sub In An Aspx Webpage?

Aug 26, 2010

How do declare a public variable .aspx web page that can be used in all the pages within my web application?

View 3 Replies

Accessing Public Shared Function From Another Form

Mar 1, 2011

[Code]...

i have a function that i have in my data access class now i want to access it then declare and assign parameters and then insert data into database.

View 4 Replies







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