0

I'm using the Janus GridEx grid control in Visual Basic 6 and I'm trying to change one of the properties (DatabaseName) programmatically before it uses the connection. The one I set in the properties window can be wrong and I'd like to set it dynamically before it's used. I've tried to set it in Form_Initialize() or Form_Load() and neither of them override the on in the properties window before it's used.

Any ideas?

Ross
  • 362
  • 1
  • 4
  • 21

1 Answers1

0

Create one custom recordset and set to ADORecordset property's grid

gData.HoldFields
Set gData.ADORecordset = rstData

if you created one recordset with equal schema to database you can do

saved data

IDataRepository.Save(gData.ADORecordset)

Save skeleton

function Save (rs as adodb.recordset)

  Dim cn As ADODB.Connection

  Set cn = new ADODB.Connection
  cn.CursorLocation = adUseClient
  cn.Open Cnstr

  Set rs.ActiveConnection = cn
  If rs.LockType = adLockBatchOptimistic Then
     rs.UpdateBatch
  Else
     rs.Update
  End If
  Set rs.ActiveConnection = Nothing

  cn.Close
  Set cn = Nothing
end function    

for property with mask you can for example

gData.Columns("Status").ValueList.Clear

gData.Columns("Status").ValueList.Add "A", "Accepted"
gData.Columns("Status").ValueList.Add "R", "Rejected"

Interval value is preserved and user can view some more human readable

Carlos Cocom
  • 937
  • 1
  • 8
  • 23