Formatting test
-
I'm pretty new to VB programming however i'm trying to become better. i Play an online RP game , i want to make some sort of calculator with an cope and paste option so i can copy and paste info from the browser/clipboard into the program and format the text. the text might look like this : name sypto country trysto 12876 offense 12000 defense 10000 something liek that , not i need to have a way that it copies the 12000 and the 10000 for example into the calculator..how do i start this ?
-
I'm pretty new to VB programming however i'm trying to become better. i Play an online RP game , i want to make some sort of calculator with an cope and paste option so i can copy and paste info from the browser/clipboard into the program and format the text. the text might look like this : name sypto country trysto 12876 offense 12000 defense 10000 something liek that , not i need to have a way that it copies the 12000 and the 10000 for example into the calculator..how do i start this ?
If you're playing Utopia (http://games.swirve.com/utopia) there is a good calculator already (http://utopia.sourceforge.net/) :). Use the Clipboard object to get the text you just copied from the browser, and afterwards you can treat the text as string. I am assuming each line is separated by Char(13) and you can probably split them into an array using the Split() function and get the data you want from the array. Here's an example from MSDN on how to use clipboard (you need the namespace System.Windows.Forms): Private Sub button2_Click(sender As Object, e As System.EventArgs) ' Declares an IDataObject to hold the data returned from the clipboard. ' Retrieves the data from the clipboard. Dim iData As IDataObject = Clipboard.GetDataObject() ' Determines whether the data is in a format you can use. If iData.GetDataPresent(DataFormats.Text) Then ' Yes it is, so display it in a text box. textBox2.Text = CType(iData.GetData(DataFormats.Text), String) Else ' No it is not. textBox2.Text = "Could not retrieve data off the clipboard." End If End Sub 'button2_Click