[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

ComboBox(Dropdown) values from Match in StringGrid

I have a form with a ComboBox and a StringGrid. The stringgrid gets populated from an INIFile. When a user clicks on a Combobox, the entries from the first column (a file name) is placed in the combobox. The second StringGrid part of the grid is a path string. I need to append this path, with the new value listed in Combox Box. So if I need to launch the file, the path is found, plus the name of the file is added. I have tried this but it fails:
(ListGrid.Cells[0,I] = ComboBox1.Text)

Any Ideas?
0
routerboy309
Asked:
routerboy309
  • 2
  • 2
  • 2
  • +1
1 Solution
 
PeterLarsenCommented:
Give us a code sample, please !!
0
 
rwilson032697Commented:
The line fails (I assume to compile) because there is a syntax error:

ListGrid.Cells[0,I] = ComboBox1.Text

should be

ListGrid.Cells[0,I] := ComboBox1.Text;

Your description is hard to understand...

Does that help? If not can you describe in more detail what the problem is...

Cheers,

Raymond.
0
 
routerboy309Author Commented:
I left off the ; sorry. Here is a cut and paste of portions:

from the INI File,

[ListGrid]
Cell0-1=Test.exe
Cell1-1=C:\Jims_Test

and is read/stored in the StringGrid here:

from the ShowForm of the EXE:

 for J := 0 to RowCount + (Rowcount + 1) do
         for K := 0 to Colcount + (ColCount + 10) do
            Cells[J, K] := IniFile.ReadString(ListGrid.Name, Format('Cell%d-%d', [J,K]), '');
        IniFile.Free;

Then from the ComboBox, I use:

 with MainForm.ListGrid do begin
        ComboBox1.Items.Assign(MainForm.ListGrid.Cols[0]);

to populate the ComboBox.

Click on the ComboBox, and the DropDown fires getting the value of Column 0, passing it to the Combox Box like a list.

Now that the ComboBox has the value (in this case - Test.exe), I need to append that value, with the path that is listed in the correct part of the string grid. This is what I don't understand how to do.

I have a button that will run the exe. I plan on doing a shellexecute (and I have a sample of that code.) So I need to get an sample of how to get the value of the path, added to the first column. How this helps?
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
rwilson032697Commented:
Is this what you mean:

ThePathIWant := ListGrid.Cells[1, ComboBox.ItemIndex]+'\'+ComboBox.Text;

Cheers,

Raymond.
0
 
PeterLarsenCommented:
I agree with Raymond.

You don't say whether you are a beginner or not. Sometimes it will help if you do so..

/PL
0
 
smartkidCommented:
Text property of a TComboBox can be retrieved when you set the Style property to csDropDown but not csDropDownList.
If you set the Style property to csDropDownList, you can use AComboBox.Items.Strings[AComboBox.ItemIndex] to get the selected text.
0
 
routerboy309Author Commented:
I don't concider myself a beginner, not certainly not an expert (maybe above beginner, and almost in the range of intermediate). Thanks for the help. It work as I needed.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now