Click here to Skip to main content
15,907,493 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Possible to return strings with >255 characters in Excel? Pin
AlexesDad30-Jun-09 11:40
AlexesDad30-Jun-09 11:40 
QuestionErrors occurs while compiling Smart device MFC application using VS2005 Pin
saksp12-Jun-09 20:42
saksp12-Jun-09 20:42 
GeneralRe: Errors occurs while compiling Smart device MFC application using VS2005 Pin
Arun Singh K13-Jun-09 1:00
Arun Singh K13-Jun-09 1:00 
Questionweight and bias chage problem in neural network AND gate Pin
salahuddincse12-Jun-09 17:04
salahuddincse12-Jun-09 17:04 
QuestionI'm hoping some C# Guru out there can help me... (IndexOf and Multidimension Arrays) Pin
Paul Calabro12-Jun-09 14:48
Paul Calabro12-Jun-09 14:48 
AnswerRe: I'm hoping some C# Guru out there can help me... (IndexOf and Multidimension Arrays) Pin
Luc Pattyn12-Jun-09 14:58
sitebuilderLuc Pattyn12-Jun-09 14:58 
AnswerRe: I'm hoping some C# Guru out there can help me... (IndexOf and Multidimension Arrays) Pin
Wonde Tadesse12-Jun-09 15:43
professionalWonde Tadesse12-Jun-09 15:43 
GeneralRe: I'm hoping some C# Guru out there can help me... (IndexOf and Multidimension Arrays) Pin
Paul Calabro15-Jun-09 5:14
Paul Calabro15-Jun-09 5:14 
Sorry for the delay..
What I'm trying to do is this: I want to be able to do is click an item in a list, determine which item in the list was clicked (which I'm able to do with the 'selectedItems' property of the listView object), and use the text property of that item to search a multidimensional array. If I click on 'Server A', I want to search with a foreach and find the element that has the string 'Server A'..
And then find all the OTHER associated information with it, such as the IP Address or the resource info or the User associated with it...

Thanks for any help on this one!

[1]["Server A"]
[1]["192.168.0.1"]
[1]["pic.gif"]
[1]["Bob"]
[2]["Server B"]
[2]["192.168.0.2"]
[2]["pic2.gif"]
[2]["Joe"]
and so forth..


public partial class Form1 : Form
    {
        String[,] contactRecords = new String[50, 3]; //2-D array to hold our contact info.
        String[,] serverRecords = new String[50, 4]; //2-D array to hold our server info.

        public Form1()
        {
            InitializeComponent();
        }

        public void importSettings(object sender, EventArgs e)
        {


            /// Import contact settings
            StreamReader sr = new StreamReader("contact.data");
            String line = sr.ReadLine();
            String[] lineSplit = line.Split(',');
            for (int i=0;line != null; i++)
            {
                lineSplit = line.Split(',');
                contactRecords[i, 0] = lineSplit[0]; //First Name
                contactRecords[i, 1] = lineSplit[1]; //Title
                contactRecords[i, 2] = lineSplit[2]; //Phone #

                line = sr.ReadLine();
            }

            for (int x = 0; contactRecords[x, 0] != null; x++)
            {
                CLB_Contact.Items.Add(contactRecords[x, 0]);
            }
            sr.Close();



            /// Import server settings
            StreamReader sr2 = new StreamReader("servers.data");
            String line2 = sr2.ReadLine();
            String[] lineSplit2 = line2.Split(',');
            for (int j=0; line2 != null; j++)
            {
                lineSplit2 = line2.Split(',');
                serverRecords[j, 0] = lineSplit2[0]; //Host Name
                serverRecords[j, 1] = lineSplit2[1]; //IP Address
                serverRecords[j, 2] = lineSplit2[2]; //Resouces Accessed
                serverRecords[j, 3] = lineSplit2[3]; //Contacts

                line2 = sr2.ReadLine();
            }
   
            for (int x = 0; serverRecords[x, 0] != null; x++)
            {
                Servers_LV.Items.Add(serverRecords[x, 0]);
            }
            sr.Close();

   
        }

        public void helloWorld(object sender, MouseEventArgs e)
        {
            ListView.SelectedListViewItemCollection list = Servers_LV.SelectedItems;
            foreach (String x in serverRecords)
            {
                if (x == list[0].Text)
                {
                    TB_IPAddress.Text = x;
                    Array.IndexOf(serverRecords, x);
                }
            }
        }
    }

GeneralRe: I'm hoping some C# Guru out there can help me... (IndexOf and Multidimension Arrays) Pin
Wonde Tadesse16-Apr-11 13:48
professionalWonde Tadesse16-Apr-11 13:48 
JokeI'm hoping you eventually hit the right forum... Pin
CPallini12-Jun-09 22:41
mveCPallini12-Jun-09 22:41 
Question[Message Deleted] Pin
xchen199812-Jun-09 7:35
xchen199812-Jun-09 7:35 
AnswerRe: Custom Control Pin
xchen199813-Jun-09 13:44
xchen199813-Jun-09 13:44 
QuestionHelp with rand() definition [modified] Pin
Grimes12-Jun-09 6:58
Grimes12-Jun-09 6:58 
AnswerRe: Help with rand() definition Pin
Luc Pattyn12-Jun-09 7:14
sitebuilderLuc Pattyn12-Jun-09 7:14 
GeneralRe: Help with rand() definition Pin
Grimes12-Jun-09 7:47
Grimes12-Jun-09 7:47 
AnswerRe: Help with rand() definition Pin
Randor 12-Jun-09 7:16
professional Randor 12-Jun-09 7:16 
GeneralRe: Help with rand() definition Pin
Grimes12-Jun-09 8:02
Grimes12-Jun-09 8:02 
GeneralRe: Help with rand() definition Pin
harold aptroot12-Jun-09 8:50
harold aptroot12-Jun-09 8:50 
GeneralRe: Help with rand() definition Pin
Grimes12-Jun-09 17:03
Grimes12-Jun-09 17:03 
GeneralRe: Help with rand() definition [modified] Pin
T210212-Jun-09 22:57
T210212-Jun-09 22:57 
GeneralRe: Help with rand() definition Pin
Grimes12-Jun-09 23:44
Grimes12-Jun-09 23:44 
GeneralRe: Help with rand() definition [modified] Pin
T210212-Jun-09 23:57
T210212-Jun-09 23:57 
QuestionHow to Custom a papersize during a printer work under windows 2000/xp [modified] Pin
Crazy Wu12-Jun-09 5:40
Crazy Wu12-Jun-09 5:40 
AnswerRe: How to Custom a papersize during a printer work under windows 2000/xp Pin
Crazy Wu12-Jun-09 17:36
Crazy Wu12-Jun-09 17:36 
QuestionConversion Pin
reddy0712-Jun-09 5:08
reddy0712-Jun-09 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.