Jump to content

VB.NET 2008 Help Needed


Apache

Recommended Posts

....I say simple but I asked in the chat room and it turned into a 10 min VB Bashing session and everyone giving answers in different languages, different platforms and various other things completely off topic.

My problem is simple.

I want to reset every variable in my program to their original state and refresh it to show the new (old) values. Effectively soft booting the program with factory settings but I want to do it with the least lines possible.

This is for a Uni Project (I would never ask for people to code my projects for me) I just need advice for this one small problem. It need to be written in pure VB.NET 2008 and this is at Undergrad level so it's still very very basic stuff.

Please don't turn this into a VB slagging thread, puritans and egotists, try to be helpful for once. Yes, I would love to do it in C++ or Python, all problems would be solved but I can't.

I've tried things like MyBase.Refresh() and Me.Invalidate() and nothing I've tried or searched for online so far works.

Link to comment
Share on other sites

....I say simple but I asked in the chat room and it turned into a 10 min VB Bashing session and everyone giving answers in different languages, different platforms and various other things completely off topic.

My problem is simple.

I want to reset every variable in my program to their original state and refresh it to show the new (old) values. Effectively soft booting the program with factory settings but I want to do it with the least lines possible.

This is for a Uni Project (I would never ask for people to code my projects for me) I just need advice for this one small problem. It need to be written in pure VB.NET 2008 and this is at Undergrad level so it's still very very basic stuff.

Please don't turn this into a VB slagging thread, puritans and egotists, try to be helpful for once. Yes, I would love to do it in C++ or Python, all problems would be solved but I can't.

I've tried things like MyBase.Refresh() and Me.Invalidate() and nothing I've tried or searched for online so far works.

You could create a function (or method, what ever VB calls it) that sets all the specified variables to there original value if the value is known. This will remove redundant code at least.

Link to comment
Share on other sites

Apologies about the tone in the OP, I'd been watching PurePwnage for a few hours and been on some very cynical forums and the response I got from the chat room really surprised me. I really do appreciate people taking the time to respond.

I've had to settle for a function setting initial global variables with a Select Case to reset additional localised variables when the function is called to reset rather than initialise. It's about 30 extra lines of code I could do without though.

I might just write my own class for it so I've got it for future use. I'll post a snippet once it's done.

Link to comment
Share on other sites

Apologies about the tone in the OP, I'd been watching PurePwnage for a few hours and been on some very cynical forums and the response I got from the chat room really surprised me. I really do appreciate people taking the time to respond.

I've had to settle for a function setting initial global variables with a Select Case to reset additional localised variables when the function is called to reset rather than initialise. It's about 30 extra lines of code I could do without though.

I might just write my own class for it so I've got it for future use. I'll post a snippet once it's done.

I was thinking of something like this

form1.activeform.visable= false

form1.activeform.visable= true

it would close down the program and reopen right away if you dont mind the form to close this might be the cheating way to do it they only other thing that comes into my mind is make an array with all the field and loop true the array to set everything to ""

Link to comment
Share on other sites

The Object.Visible argument doesn't do anything other than make it invisible.

Private Sub FormVisible()
  Form1.Visible = False
  Form1.Visible = True
End Sub

This would effectively do nothing as the change would be instantaneous and no change will have occurred.

On the other hand...

Private Sub FormReload()
  Form1.Dispose()
  Form1.Activate()  
End Sub

This would work but the program closes when Form1 is closed. Form1.Hide() wouldn't work either as that's equivalent of setting the visibility to 0.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...