Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:16:28+00:00 2026-06-15T03:16:28+00:00

I’ve got a button where if I click it, it retrieves player information on

  • 0

I’ve got a button where if I click it, it retrieves player information on a game server.
I need to figure out a way to display this in a grid.

When I do a Console.Write(sendRConCommand(“players”))

This is outputted to my console:

Players on server:
[#] [IP Address]:[Port] [Ping] [GUID] [Name]
--------------------------------------------------
0   XXX.XXX.XXX.XXX:XXXX    46   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) [FF]Otto
1   XXX.XXX.XXX.XXX:XXXX   109  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) [BBC] Emma Watson
2   XXX.XXX.XXX.XXX:XXXX      46   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) [FF]Miikka
3   XXX.XXX.XXX.XXX:XXXX   46   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) Bops
4   XXX.XXX.XXX.XXX:XXXX      32   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) [BBC] Wesley Snipes
5   XXX.XXX.XXX.XXX:XXXX    31   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) Pierre
6   XXX.XXX.XXX.XXX:XXXX     46   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) bertrand
7   XXX.XXX.XXX.XXX:XXXX     -1   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) SIGGI (Lobby)
8   XXX.XXX.XXX.XXX:XXXX    47   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) Min (Lobby)
9   XXX.XXX.XXX.XXX:XXXX     32   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) Frostpwnz
10  XXX.XXX.XXX.XXX:XXXX   31   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) Zulu BASSA (Lobby)
11  XXX.XXX.XXX.XXX:XXXX     31   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) Zardock (Lobby)
14  XXX.XXX.XXX.XXX:XXXX    63   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(OK) plbmas
(13 players in total)

I need to figure out how to display this information in a grid, with the column headers that are shown as well.

Thanks in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:16:29+00:00Added an answer on June 15, 2026 at 3:16 am

    You will need to convert the text into a data structure. Currently it is all text, so it will be displayed in only one column.

    I suggest, you split the data based on carriage returns, then for each player row (line 3 onwards), split the columns. The following is a rough code outline, edit as required.

            // Setup Datatable to hold the information
            DataTable dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[] {
                new DataColumn("Number", typeof(int)), 
                new DataColumn("IP Address", typeof(string)),
                new DataColumn("Ping", typeof(int)),
                new DataColumn("GUID", typeof(string)),
                new DataColumn("Name", typeof(string))
            });
    
            // Get info            
            string info = sendRConCommand("players");
    
            // Split Rows
            string[] infoRows = info.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            int start = 3; // ignore first 3 lines
            while (start < infoRows.Length - 1) // Ignore last line
            {
                // Split row on spaces, and remove anything that is an empty space
                string[] row = infoRows[start].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                DataRow dr = dt.NewRow();
                dr["Number"] = int.Parse(row[0].ToString());
                dr["IP Address"] = row[1].ToString();
                dr["Ping"] = int.Parse(row[2].ToString());
                dr["GUID"] = row[3].ToString();
                int nameItem = 4;
                while (nameItem < row.Length)
                {   // Names can have spaces, so we need to merge
                    dr["Name"] += " " + row[nameItem].ToString();
                    nameItem++;
                }
                dr["Name"] = dr["Name"].ToString().Trim(); // Trim any leading spaces
                dt.Rows.Add(dr);
                start++;
            }
    
            // Job Done
            mygridview.DataSource = dt;
    

    Where mygridview is your grid.

    I have put it all into a data table, but custom objects, list etc would also work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.