Array Convertion
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
hello Im building a program that is retrieving a lot of info in the form of
array lists but I am finding it hard to find a nice clean low code way of
converting these lists into
Strings for a textbox
Items for a listbox
text for labels
That type of thing so I was wondering if anyone would be able to either comment how or better yet make a full tut on array lists as well before this program I barley used them and when I did it was to save data and never open it in program again :(
And pluss that code was googled so I didn't really understand much just bits
array lists but I am finding it hard to find a nice clean low code way of
converting these lists into
Strings for a textbox
Items for a listbox
text for labels
That type of thing so I was wondering if anyone would be able to either comment how or better yet make a full tut on array lists as well before this program I barley used them and when I did it was to save data and never open it in program again :(
And pluss that code was googled so I didn't really understand much just bits
A list of strings is fairly straight forward...
Create a list:
Create a list:
Code: Select all
Add item(s) to list:Dim SomeList As New List(Of String)
Code: Select all
Go through the list and add items to listbox example:SomeList.Add("bob")
Code: Select all
If that's what you're looking for lol cooll;For Each item As String In SomeList
ListBox1.Items.Add(item)
Next
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Thank you but it dose not work maybe I can try and explain my self a little better by showing the code
I am using JSONAPI To try and make a minecraft control client for servers hosted on websites
now I need to use a method in the config that with the following name and calls ect..
S
Y
S
T
E
M
C
O
L
E
C
T
I
O
N
I am using JSONAPI To try and make a minecraft control client for servers hosted on websites
now I need to use a method in the config that with the following name and calls ect..
Code: Select all
now I am trying to use the follow code to retrieve this information (edited to add updates from codenstuff)
{
"name":"getPlayerNames",
"desc":"Retrieves an array of the names of all the players currently on the server.",
"returns":["String[]", "The players' names."],
"call":"this.getPlayerNames()"
},
Code: Select all
but this returns the following in listbox form Dim result As Dictionary(Of Object, Object) = j.[call]("getPlayerNames", arr)
Dim SomeList As New List(Of String)
For Each item In result.ToString
SomeList.Add(item)
Next
For Each item As String In SomeList
If ListBox1.Items.Contains(item) Then
Else
ListBox1.Items.Add(item)
End If
Next
S
Y
S
T
E
M
C
O
L
E
C
T
I
O
N
Erm yes I have no idea at this point :lol:
You should probably be using a proper Json class to parse all this data but maybe this will work, I pieced this together from the github code:
Maybe someone else will know how to use this JSONAPI thing effectively cooll;
You should probably be using a proper Json class to parse all this data but maybe this will work, I pieced this together from the github code:
Code: Select all
My experience with parsing json data isn't a whole lot so I'm not sure :? Dim result As New Dictionary(Of Object, Object) = j.[call]("getPlayerNames", arr)
For Each o As Object In result
For Each key As Object In DirectCast(o, String).Values
ListBox1.Items.Add(Convert.ToString(key))
Next
Next
Maybe someone else will know how to use this JSONAPI thing effectively cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Thank you and I understand im in the same boat right now
They should make the support for vb a lot better tbh but their we go
Anyway that code looks a lot better but I get this error
Unable to cast object of type 'System.Collections.Generic.KeyValuePair`2[System.Object,System.Object]' to type 'System.String'.
They should make the support for vb a lot better tbh but their we go
Anyway that code looks a lot better but I get this error
Unable to cast object of type 'System.Collections.Generic.KeyValuePair`2[System.Object,System.Object]' to type 'System.String'.
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023