Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Get value from child to parent window

Get value from child to parent window

Scheduled Pinned Locked Moved Visual Basic
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hemant kaushal
    wrote on last edited by
    #1

    Hi, In my application i have to open a new window and then to do some calculation and then to show that value on parent window. thanks in advance

    C 1 Reply Last reply
    0
    • H hemant kaushal

      Hi, In my application i have to open a new window and then to do some calculation and then to show that value on parent window. thanks in advance

      C Offline
      C Offline
      C1AllenS
      wrote on last edited by
      #2

      Hello, You can try the given solution. Lets say we have two forms Form1 and Form2. In form2 we define a function which takes the Form1 as argument. Form1 _frm; Public Sub ShowForm(ByVal frm As Form1, ByVal img As Image) _frm = frm Me.Show() End Sub Lets say we will return a value of type integer to Form1. For that we will have to define an integer variable in Form1 and a Property for that variable to set its value. Dim _val As Integer Property Val() As Integer Get Return _val End Get Set(ByVal value As Integer) _val = value End Set End Property On Button Click in Form 1 we will open the Form2 in the following manner: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As New Form2 frm.ShowForm(Me) End Sub Now in FormClosing of Form2, we will set the value. Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing _frm.Val = 2 End Sub I hope this helps. Regards, Allen

      Allen Smith ComponentOne LLC www.componentone.com

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups