Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make Flexgrid fixed col 0 to show Picture

Status
Not open for further replies.

muraliambt

Programmer
Jan 22, 2002
75
US
Hi,

1. I have flexgrid with 1 fixed row and 1 fixed column. when i add more rows, in the fixed column( column 0) i think it is displaying record no.

how is can avoid that display.

2. Instead i want to show some picture on column 0 and also focus should not got there.

Muraliambt.

 
1. How are you filling your grid with values? Is it bound or unbound?

2. Use the .cellpicture property.
Code:
With MSFlexGrid1
  .Row = 1
  .Col = 0
  Set .CellPicture = <your Picture> 'You can use image List
  .CellPictureAlignment = flexAlignCenterCenter
End With

zemp
 
Hi Zemp,

I have seen quite lot of ur posting, very impressing.

1.My flexgrid is unbound.
2. For col 1 to 15 i am using Combo box and 16-18 i am using Text Box.
3. Col 0 i made as Fixed col.

Actually what is happing the picture is displaying above the Record No.

My idea is put the picture in col 0 and whenever the user clicks the picture then message box will be displayed. And also when FlexGrid get focus it should goto col 1 instead of col 0.

It was working fine before putting the picture in COL 0.

Muraliambt.


 
Sounds like your loop to fill the grid is off by one. Post the code and we'll have a look.

I believe the text in the cell is causing the cellpicture to be 'misplaced'.

zemp
 
Hi,

I think i am putting in wrong way...

1. Everything works fine if i remove the picture in the co1 0. Col 0 is the fixed column.

2. When i add more rows in the flexgrid, the fixed col 0 showing some numbers, that i believe record no. ( like 1,2,3) in the col 0. How to remove that.

3. In the fixed Column Col 0, i want to show the picture and when the flexgrid get the focus it should goto col1 instead of col 0.

Muraliambt.





 
If you are filling manually you need to post the relevant code. Otherwise we are just guessing. That doesn't help you.

zemp
 
Here is the Code.

Private Sub ShowDetail()
Dim strBrcode As String, strVouno As String
Dim strSQL As String
Dim i As Integer
i = 1

FG1.Clear
Call CreateFlexGrid

strBrcode = dcomBranch.BoundText
strVouno = vouno.Text

If RsDet.State = 1 Then
RsDet.Close
End If

strSQL = "SELECT * from cash_dt "
strSQL = strSQL & " WHERE cash_dt.br_code = '" & strBrcode & "' and cash_dt.vouno = '" & strVouno & "' "

RsDet.Open strSQL, sDBconn, adOpenStatic, adLockOptimistic

If Not RsDet.EOF Then
'Load the Grid with details
RsDet.MoveFirst
Do Until RsDet.EOF
With FG1
FG1.AddItem (FG1.Rows + 1)
Call FindNames

If False Then
'To Load the Delete Picture
FG1.Row = i
FG1.Col = 0
Set .CellPicture = LoadPicture(App.Path & "\BMP\DELETE.BMP")
.CellPictureAlignment = flexAlignCenterCenter
End If

.TextMatrix(i, 1) = sPCcode
.TextMatrix(i, 2) = sPCname
.TextMatrix(i, 3) = sAcccode
.TextMatrix(i, 4) = sAccname
.TextMatrix(i, 5) = sSLcode
.TextMatrix(i, 6) = sSLname
.TextMatrix(i, 7) = sCCcode
.TextMatrix(i, 8) = sCCname
.TextMatrix(i, 9) = sBRcode
.TextMatrix(i, 10) = sBrname
.TextMatrix(i, 11) = sPRcode
.TextMatrix(i, 12) = sPRname

.TextMatrix(i, 13) = IIf(IsNull(RsDet!ref_no), vbNullString, RsDet!ref_no)
'.TextMatrix(i, 14) = IIf(IsNull(RsDet!lot_no), vbNullString, RsDet!lot_no)
'.TextMatrix(i, 15) = IIf(IsNull(RsDet!pr_no), vbNullString, RsDet!pr_no)
.TextMatrix(i, 16) = sNarr
.TextMatrix(i, 17) = Format(dDebit, "###,###,###,##0.00")
.TextMatrix(i, 18) = Format(dCredit, "###,###,###,##0.00")
.TextMatrix(i, 19) = sGlnature
End With
i = i + 1
RsDet.MoveNext
Loop
End If
End Sub
 
I would remove this line,
Code:
FG1.AddItem (FG1.Rows + 1)
I think that it is adding the row number to the current column. The .additem method will create a new row and add values to the corresponding cells. In this case you are adding the value (FG1.Rows + 1) to the first column. That may be why it looks like row values.

If you want to increase the number of rows just do this.
Code:
FG1.Rows = FG1.Rows + 1


zemp
 
Hi

Exactly that is what happening. It's OK now and Foucus to FlexGrid also going to the Col1 Instead of col0

Thanks a lot...

Muraliambt.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top