Results 1 to 5 of 5

Thread: [RESOLVED] Change string value from a function?

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Resolved [RESOLVED] Change string value from a function?

    Is it possible to change the value of a string from a function, because I'm having a problem here?
    The general idea would be like below, but the string will not change, so is there any way I make that happen?

    vb.net Code:
    1. Public Class Form1
    2.  
    3. Dim MyItem1, MyItem2, MyItem3 As Integer
    4.  
    5. Public Function SetItemStats(ByVal CurrentItemSlot As ComboBox, ByVal CurrentItemName As String)
    6.         CurrentItemName = CurrentItemSlot.Text
    7. End Function
    8.  
    9. Private Sub SetItem1Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetItem1Button.Click
    10.         SetItemStats(item1list, MyItem1) ' item1list is the name of my combobox.
    11.         MsgBox(MyItem1) ' Comes out empty here
    12. End Sub
    13.  
    14. End Class

    EDIT: Fixed that by changing ByVal into ByRef, I'm such an idiot.
    Last edited by Legjendat; Jan 11th, 2013 at 01:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width