StringGrid Column

When I click on column 3, I am trying to get the value of column 2.  Currently I am doing it like this

String tmpVar = StringGrid1->Cells[StringGridExercise->Col-1][StringGrid1->Row];

How come I can't hard code the column like

String tmpVar = StringGrid1->Cells[StringGridExercise->Col[2]][StringGrid1->Row];

I know this is not the way to do it, how is it actually done?



Thanks.
0
Steven
12/4/2011 8:20:57 PM
embarcadero.cppbuilder.using 1848 articles. 1 followers. Follow

1 Replies
576 Views

Similar Articles

[PageSpeed] 5

> {quote:title=Steven Murphy wrote:}{quote}
> When I click on column 3, I am trying to get the value of column 2.  Currently I am doing it like this
> 
> String tmpVar = StringGrid1->Cells[StringGridExercise->Col-1][StringGrid1->Row];
> 
> How come I can't hard code the column like
> 
> String tmpVar = StringGrid1->Cells[StringGridExercise->Col[2]][StringGrid1->Row];
> 
> I know this is not the way to do it, how is it actually done?
> 
> 
> 
> Thanks.

Did you notice that you are using two different grid objects in your reference: StringGrid1 and StringGridExercise?
Can you please be more clear on *what* you are trying to do?
As far as I can understand you question, indices for rows and columns are zero based. That is, the index for the first row is 0, the index for the 2nd is 1 and so on.

HIH.
Omer
0
Omer
12/5/2011 5:38:56 AM
Reply:

Similar Artilces:

Using @column = [column] SQL Server 2000
Should the following select statement return ALL the records including the records where [district] is null?  Currently it is only returning non null records.  I tried it with a default value and without with the same results. SelectCommand="SELECT [ID], [last], [first], [district], [TA] FROM [regd] Where ([district] Like case when @district is null then [district] else @district end)" <SelectParameters ><asp:ControlParameter ControlID="Last_textbox" Name="district" defaultvalue="%" PropertyName="Text" Type="Str...

Get Column Number Using Column Name
This ones burning me because, I am sure i've done it before and It's simply slipping my mind. I need to be able to get a column number using the column name. i.e. Column name = 'effective_date'. Using effective date - get the column number that belongs to effective date. Any help is appreciated!! Thanks!! William dw.Describe("effective_date.ID") Good Luck Michael Walker Cascadia Software William_Shiers wrote: > This ones burning me because, I am sure i've done it before and It's simply > slipping my mind. > ...

Searching all columns without using column name
Hi, I am developing a search engine for my application and I need to grab the entire row from the table if I found the search field in any of the columns and the search is not defined to one table. Please let me know how to search all columns in table without using column names indivdually. If the data is in a DataSet, you can access rows and columns using indexes: myDS.Tables[0].Rows[0][0] will get the first row, first column. .Rows and .Columns have a .Count property that can allow you to get all columns and rows: if ( myDS.Tables.Count>0 ) { for ( int loop...

Error with dddw using computed column as data column
Hi, I'm working with PB 5.0.04 on Win 95. I have a datawindow object which I want to use as dddw. This datawindow object retrieves a numeric ID and three string fields from a table. I created a (named) computed field in the detail band which consists of a concattenation of the three string fields. I'm not allowed to use a SQL computed column. When I use this datawindow object as dddw with the computed column as display-item and the ID as data-item I can't store the (main) datawindow. I get a "syntax error at line ## in column ##" ...?? Can this be c...

validation message using column label, not column name
win2k / pb8.01 When I forget to enter a required value on a dw, I get a MessageBox like this Required value missing for COLUMN NAME on row N Please enter a value For legacy reasons my column name is called lineval and can't be changed I have set a column label in the datawindow painter to "Line Value" which would look a lot nicer in an error message. Is there anyway to specify in the dw to use the column label instead of the column name in the error message ? thanks Alex Well that's not a PB-generated error, so it must be in your code somewhere...

Using the column value of another row in computed column.
Hi fellow PBer's, I am having trouble figuring out how to reference the column value of a specific row. In the computed columns property sheet, I select the "More" button to modify the columns expression. The way I understand help is to specify columnname[integer] where integer is the number of rows (positive or negative) relative to the current row (ie Total[-1] would be the value of the Total column in the previous row. However, I cant seem to get this to compile in the modify expression painter. I am using PB5.0 on Win95. Any help would be greatly appreciated. ...

how to fetch column using column index in sql server.
Hi, I have several columns in my table, but I want to fetch data using column index instead of column name in select  command. is there any way to do this.Please remember to click “Mark as Answer” on the post that helps youJasim AkhtarNew Delhi ( INDIA ) Yes there is.It's called dynamic SQL and it's a complicated process.See http://www.sommarskog.se/dynamic_sql.html Please click "Mark as Answer" if my reply solved your problem.CheersRammohan...

Reference gridview column index using column headers
 Greetings,I have several GridViews all showing different collections of similar product data.  Due to changes in codes used to distinguish properties such as color and size, I'm having to write several rules into the row databound events.  The issue I'm having is that the group who will be using the application haven't finalized the order of the columns, so everytime I reorder the columns, I have to changes all the column indexes in my code behind so that the rules are being applied to the right columns. I'd like to know if there is a way to reference the colu...

how to move from column to column using rightarrow, leftarrow or enter?
I have the codein datawindow custom event to capture if the user is pressing rightarrow, leftarrow or enter. I want to be able to move from column to column either right or left. How can I do that in the datawindow? Is there an offset function? I havent seen one. CHOOSE CASE key CASE KeyLeftArrow! file://move to the left cell CASE KeyRightArrow! file://move to the right cell CASE KeyEnter! file://move to the left cell, same as tab END CHOOSE -- Thanks, Stephane Viau Ottawa, Canada Ottawa, Canada It is obviously possible to do this (just search...

When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go against the same table. Recently, I had to add a column to that table, and also add the column to ALL of these datawindows that go against this table. I added the column to the first datawindow, set up the edit control style, etc. I then did a copy/paste of the columns edit control to the remaining dw's (of course remembering to first add the column in SQL). Everything (update props, column specs, column props) seems to indicate that the pasted column is linked to the column I selected, HOWEVER, when I...

Hiding columns in the ItemDataBound event without using the column index
Lately I've needed to hide certain columns in DataGrids depending on the specific data source so I create a property at the top of the page like so: private string DisplayProjDesc //DisplayProjDesc property - for ItemDataBound event of the DataGrids to determine whether to display project description { set { this.lblBoolDispProjDesc.Text = value; } get { return this.lblBoolDispProjDesc.Text.ToUpper(); } }Then, in the ItemDataBound event of the DatGrid, I use something like: if(this.DisplayProjDesc=="TRUE") { this.dgProject.Columns[7].Visible=true; } else { this.dgProject....

Hide a Gridview column but use the value in that column when the row is selected.
I need to retrieve a column from my database but do not want to display it in the gridview.  However, I need to be able to show that information later in the application.  I am using the wizard control.  I believe I can use the DataKeyValues property of the gridview but can't figure out how to write the code to get the value of the cell in that column when the row is selected so it can be referenced later.  I am using VB.  Thanks for your help!! Found the answer.  Here it is in case anyone else needs it:       &nbs...

Cannot delete columns of GridView by using "Edit Columns..."
Hi all, I have a GridView with quite a few auto-generated fields. When I go to GridView Tasks to use "Edit Columns..." to delete a few columns, the design window shows the columns removed just as expected. However, the source code does not change at all. If I save the .aspx file and reopen it, it shows all the deleted columns like nothing has changed.  I can go to the source code to delete the fields and the deletion will stay.  I am using VS 2008 standard edition. Could anyone shed some light on this?  Hong Hi,In the gridview have some Bound fields from edit co...

Have problem setting column back to first column using pbm_dwnprocessenter
Used pbm_dwnprocessenter to emulate 'Enter' key as 'Tab' in PB, but is having trouble in setting the focus back to first column when datawindow hit the last column. Please help. IF GetColumnName() = 'the_last_column' THEN SetColumn ('the_first_column') ELSE Send ('that_stuff_to_simulate_tab') END IF "matchoy" <matchoy@hotmail.com> wrote in message news:3f8cb4bb@forums-2-dub... > Used pbm_dwnprocessenter to emulate 'Enter' key as 'Tab' in PB, but is > having trouble in setting the focus bac...

Web resources about - StringGrid Column - embarcadero.cppbuilder.using

Resources last updated: 12/9/2015 4:17:22 PM