Link to home
Start Free TrialLog in
Avatar of jana
janaFlag for United States of America

asked on

Visual Basic DataGrid with Headers & format it

We have a VB6 apps using DataGrid.

We have manage to show the grid with the SQL data.  We need to add the Headers & format the sales.

We :
- We set the form
- add the ADODC object
- at form load() we set the select as follows (which displays perfectly on the form):

Private Sub Form_Load()
 Dim sSql As String
 sSql = "select Departmment, Region, Sales from Territorial"
 adocTerritorial.ConnectionString = cnn
 adocTerritorial.RecordSource = sSql
 adocTerritorial.Refresh
End Sub

We need to custiomize title and format Sales to $xxx.xx
SOLUTION
Avatar of game-master
game-master
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jana

ASKER

ok...worked!

What about formatting it woth currency, comma & right align?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jana

ASKER

Somehow its not working, no effect on the screen; still show the actual SQL string result with the difference, the Title you showed me.

The display shows the grid as follows:

Department      Region      Sales
-------------- ------------  ------------
San Fran        SouthE      6559.36
New York       West-Q    256314.1
Jersey            North-W   501.06

And I need it to be:

Department      Region             Sales
-------------- ------------  ----------------
San Fran        SouthE         $65,59.36
New York       West-Q    $256,314.10
Jersey            North-W          $501.06
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jana

ASKER

I am using SQL 2000.  I have formatted the SELECT prior diaplsy, but it still shows as its saved in the table.

Hi BrianVSoft, that the question I was looking for.  Can you tell which question it was?

I revied my code, I dont have MSFlexGrid1 included.  MSFlexGrid1 is better that MSDATGRID.ocx?
Avatar of jana

ASKER

I hope you don't mind we stick to DataGrid at this point.  Just found out that the entire apps are in DataGrid I dont want to change my programmer scheme (he out of the country).

I just saw his apps and all  DataGrids have Headers.. yet I search within the apps and can;t find where the Headers is defined.  

On the app I am working on I need to place.  Can someone tell me where I can change the Header and format the columns (I know that the answer of placing the titles worked, but my app has to be consisten as the rest and the rest of the apps has formatted headers)


Unfortunately, u cannot able to format the header the way u like it..
That is sumhow, the limitation of the datagrid control...

Datagrid is binded to your recordset.


game-master
Avatar of jana

ASKER

Hi I did find a way to change the header of the DataGrid:

going to the properties of the datagrid and choosing columns and entering the changes in "Caption".

Just to say that game-master also works.

Thanx all