Click here to Skip to main content
15,911,531 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Subclass control Pin
Dave Kreskowiak8-Sep-07 6:12
mveDave Kreskowiak8-Sep-07 6:12 
QuestionSystem is not accessible on network is VPN is installed on machine Pin
Rizwan Bashir7-Sep-07 21:40
Rizwan Bashir7-Sep-07 21:40 
AnswerRe: System is not accessible on network is VPN is installed on machine Pin
Dave Kreskowiak8-Sep-07 2:43
mveDave Kreskowiak8-Sep-07 2:43 
GeneralRe: System is not accessible on network is VPN is installed on machine Pin
Rizwan Bashir9-Sep-07 23:18
Rizwan Bashir9-Sep-07 23:18 
Questionhow to submit information to a web page with vb.net Pin
eyes20077-Sep-07 20:19
eyes20077-Sep-07 20:19 
AnswerRe: how to submit information to a web page with vb.net Pin
DigiOz Multimedia8-Sep-07 13:57
DigiOz Multimedia8-Sep-07 13:57 
QuestionAccessing Custom Controls Dynamically Added Pin
vseven7-Sep-07 10:58
vseven7-Sep-07 10:58 
AnswerRe: Accessing Custom Controls Dynamically Added [modified] Pin
Hadi Hassan7-Sep-07 22:59
Hadi Hassan7-Sep-07 22:59 
Salaam Alaikom

you can solve your problem by uisng RaiseEvent, this is an example to show you the solution

suppose you have a Form called frmMain, and you did class that add to integer numbers, you need to know if the fuction Add in the Class AddTwoNumbers called or not, so u need to add event for this case

Public Class AddTwoNumbers

    Private m_firstValue As Integer
    Private m_secondValue As Integer
    Public Event OnAdd(message As String)

    Public Sub New()
         m_firstValue=0
         m_secondValue=0
    End Sub

    Public Property FirstValue()As Integer
         Get
             Return m_firstValue
         End Get
         Set(value As Integer)
             m_firstValue=value
         End Set
    End Property

    Public Property SecondValue()As Integer
         Get
             Return m_secondValue
         End Get
         Set(value As Integer)
             m_secondValue=value
         End Set
    End Property

    Public Function Add()As Integer
         RaiseEvent OnAdd("The Fuction Add is running now")
         Return m_firstValue + m_secondValue
    End Function
EndClass

now in your Form "frmMain" do this add 2 text boxes ["txtFirstValue","txtSecondValue"] boxes and a button "btnAdd"
Public Class frmMain
    Private WithEvents m_addClass As New AddTwoNumbers()
     
     ' here you can handle the Event OnAdd in the class AddTwoNumbers, 
     'that means when you call the method m_addClass.Add() the following
     'event will be fired
     Private Sub addClass_OnAdd(value As String) Handles m_addClass.OnAdd
          MessageBox.Show(value)
     End Sub

     Private Sub btnAdd_Click(sender As Object,e As EventArgs)Handles btnAdd.Click
          ' add the values of the input textboxes to the class
          If IsNumeric(txtFirstValue) Then m_addClass.FirstValue=CInt(txtFirstValue.Text.Trim())
          If IsNumeric(txtSecondValue) Then m_addClass.SecondValue=CInt(txtSecondValue.Text.Trim())
          'call the function Add, you will see 2 message boxes, one fired
          ' by the event that is found in the class and you handled it in 
          'this form, and the other by the following message
          MessageBox.Show(m_addClass.Add().ToString())
     End Sub
End Class


finally, have you a nice programming time Rose | [Rose]
regards Smile | :)

Hadi Hassan
Lebanon,Beirut
hadi.84@hotmail.com


-- modified at 5:09 Saturday 8th September, 2007
GeneralRe: Accessing Custom Controls Dynamically Added [modified] Pin
vseven10-Sep-07 3:02
vseven10-Sep-07 3:02 
GeneralRe: Accessing Custom Controls Dynamically Added Pin
vseven11-Sep-07 2:09
vseven11-Sep-07 2:09 
QuestionHow can I build a String by reading through a Data Grid? Pin
CCG37-Sep-07 9:50
CCG37-Sep-07 9:50 
AnswerRe: How can I build a String by reading through a Data Grid? Pin
Dave Kreskowiak7-Sep-07 9:57
mveDave Kreskowiak7-Sep-07 9:57 
GeneralRe: How can I build a String by reading through a Data Grid? Pin
CCG37-Sep-07 10:04
CCG37-Sep-07 10:04 
AnswerRe: How can I build a String by reading through a Data Grid? Pin
Trupti Mehta9-Sep-07 23:01
Trupti Mehta9-Sep-07 23:01 
QuestionTrimming a String Pin
Ravi Mahavrathayajula7-Sep-07 9:35
Ravi Mahavrathayajula7-Sep-07 9:35 
AnswerRe: Trimming a String Pin
Dave Kreskowiak7-Sep-07 9:36
mveDave Kreskowiak7-Sep-07 9:36 
AnswerRe: Trimming a String Pin
Kschuler7-Sep-07 9:39
Kschuler7-Sep-07 9:39 
GeneralRe: Trimming a String Pin
Dave Kreskowiak7-Sep-07 9:45
mveDave Kreskowiak7-Sep-07 9:45 
GeneralRe: Trimming a String Pin
Ravi Mahavrathayajula7-Sep-07 10:04
Ravi Mahavrathayajula7-Sep-07 10:04 
GeneralRe: Trimming a String Pin
Ravi Mahavrathayajula7-Sep-07 10:04
Ravi Mahavrathayajula7-Sep-07 10:04 
AnswerRe: Trimming a String Pin
nishkarsh_k8-Sep-07 9:23
nishkarsh_k8-Sep-07 9:23 
QuestionPrinting a bound datagrid usint new DataGridViewPrint class Pin
2wit2woo7-Sep-07 8:03
2wit2woo7-Sep-07 8:03 
AnswerRe: Printing a bound datagrid usint new DataGridViewPrint class Pin
Dave Kreskowiak7-Sep-07 8:32
mveDave Kreskowiak7-Sep-07 8:32 
GeneralRe: Printing a bound datagrid usint new DataGridViewPrint class Pin
2wit2woo7-Sep-07 8:54
2wit2woo7-Sep-07 8:54 
GeneralRe: Printing a bound datagrid usint new DataGridViewPrint class Pin
Dave Kreskowiak7-Sep-07 9:30
mveDave Kreskowiak7-Sep-07 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.