• 0

[VB6] Sharing A Variable Between Forms


Question

I've got a program with multiple forms in VB6 and I want to share the contents of a text box on one form with another form. I did a search and it seems like a I have to use a public property but I can't get it to work.

What do I need to put in the Let and Get procedure, and how do I assign the value of the text box to the variable and call the variable in the other form?

Thanks.

Link to comment
https://www.neowin.net/forum/topic/285645-vb6-sharing-a-variable-between-forms/
Share on other sites

9 answers to this question

Recommended Posts

  • 0
  blobblob said:
I've got a program with multiple forms in VB6 and I want to share the contents of a text box on one form with another form. I did a search and it seems like a I have to use a public property but I can't get it to work.

What do I need to put in the Let and Get procedure, and how do I assign the value of the text box to the variable and  call the variable in the other form?

Thanks.

585476931[/snapback]

Don't you need a global variable? Or is there a better way?

Also you might be able to point to the textbox if it stays in memory. (frmName.txtbox)

I'm not much good in VB but I remember a little from college.

  • 0

Well like you said you use the public property

Public thingy as String

To call it from the other form just prefix everything you do with the forms name

So if you were on Form2 and wanted to assign and call the variable you would go

Form1.thingy = Form1.textbox.text
msgbox Form1.thingy

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Console game sales still make more money than PC game sales. Both behind mobile game sales. Both Microsoft and Sony are making big money off of the games Microsoft is porting to PS. Those 75 million PS5’s are making an impact. There is a big market for console gaming and only Xbox console sales have suffered. The PS5 is on track to out sell the PS4. Yes Sony is porting their games to PC 18 months on average after they hit the PS5. Most console gamers want nothing to do with PC gaming especially Windows 11.
    • Oooh so that’s why. I was about to say there’s zero financial incentive to stop releasing songs for an EXISTING platform, but now I understand. Pathetic. I was planning on buying this game for VR2, but I guess I’ll just stick with Synth Riders then.
    • WD SSDs still block Windows 11 24H2 download and installs, Microsoft may be guilty too by Sayan Sen Microsoft has been slowly lifting several upgrade blocks for Windows 11 version 24H2, the 2024 feature update for Windows 11. For example, the most recent one was related to browser compatibility, and it was removed last month. This safeguard hold was lifted about a week after the company released the update such that it was available for download to everyone. However, there are still plenty of other compatibility blocks that are still in place. These include ones for Dirac Audio, sprotect SYS driver conflict, among others. Meanwhile, it looks like there is also an upgrade block on certain Western Digital SSDs that prevents them from getting the feature update. While Microsoft, or at least Windows 11, seems to be blocking the upgrade, the issue is not documented on the tech giant's health dashboard website alongside the other entries. The typical "What needs your attention" message box pops up indicating that the WD NMVe SSD in the user's system is the issue. It says: Thus, Windows thinks the WD drive in question is not compatible with the Windows 11 2024 update. As it turns out, the problem, one related to Host Memory Buffer (HMB), has seemingly already been fixed back in October 2024 with a new firmware update. However, Windows does not seem to deliver the correct link to download the update, which means users may still be unable to download Windows 11 24H2 on their PCs. A Reddit user found out that they were able to bypass the block by manually downloading the firmware from the SanDisk official support page for the corresponding drive model. They write: Thus, in case you happen to own such a disk, make sure to head over to the SanDisk Dashboard website here. It provides support for the following models: WD Green, Blue, Red, WD_BLACK, SanDisk SSD PLUS M.2, Extreme M.2, Extreme Pro M.2, Ultra 3D. You can find the instructions for updating firmware at this link. Source: Microsoft forum (link1, link2), Reddit
  • Recent Achievements

    • Week One Done
      Higante88 earned a badge
      Week One Done
    • Conversation Starter
      CarloDuplessis earned a badge
      Conversation Starter
    • First Post
      hhgygy earned a badge
      First Post
    • Collaborator
      WiltshireHam went up a rank
      Collaborator
    • One Month Later
      abhishek123323 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      719
    2. 2
      ATLien_0
      278
    3. 3
      Michael Scrip
      205
    4. 4
      +FloatingFatMan
      193
    5. 5
      Steven P.
      129
  • Tell a friend

    Love Neowin? Tell a friend!