would you check this method?
as i mentioned the Button State was not set ....
i want to save the state from each users. and Load that state...
'Load the State of CommandBar
Public Sub CommandBar_LoadState(ByVal argIDNumber As String, ByVal argEXEName As String) On Error Resume Next
Dim FreeF As Integer, sFile As String, sLayout As String strsql = " SELECT String From DockingpaneState " strsql = strsql & " WHERE UserID = '" & Trim$(argIDNumber) & "' " strsql = strsql & " AND EXEName = '" & UCase(argEXEName) & "' " If Not OpenADO1(strsql) Then Exit Sub sFile = "c:\" & Trim$(argIDNumber) & ".txt" FreeF = FreeFile Kill sFile Open sFile For Binary As #FreeF Put #FreeF, , Trim$(AdoRs1("String")) Close #FreeF AdoRs1.Close sLayout = Space(FileLen(sFile)) Open sFile For Binary As #FreeF Get #FreeF, , sLayout Close #FreeF On Error GoTo 0 CommandBars.LoadStateFromXMLString CommandBars.name, sLayout ' sLayout, "a" Kill sFile End Sub
'Save the State of CommandBar Public Sub DockingPane_SaveState(ByVal argIDNumber As String, ByVal argEXEName As String) Dim nCnt As Integer strsql = "SELECT count(*) as cnt From DockingpaneState " strsql = strsql & " WHERE UserID = '" & Trim$(argIDNumber) & "' " strsql = strsql & " AND EXEName = '" & UCase(argEXEName) & "' " Call OpenADO1(strsql) nCnt = AdoRs1("Cnt") AdoRs1.Close If nCnt = 0 Then strsql = "Insert into DockingpaneState values ( " strsql = strsql & " '" & Trim$(UserID.IDNumber) & "', " strsql = strsql & " '" & UCase(argEXEName) & "', " 'strsql = strsql & " '" & Trim$(NurseMDI.DockingPaneManager.SaveStateToString) & "') " strsql = strsql & " '" & Trim$(NurseMDI.CommandBars.SaveStateToXMLString(NurseMDI.CommandBars.name)) & "' " Else strsql = " UPDATE DockingpaneState " 'strsql = strsql & " Set string = '" & Trim$(NurseMDI.DockingPaneManager.SaveStateToString) & "' " 'strsql = strsql & " Set string = '" & Trim$(NurseMDI.CommandBars.SaveStateToString(True, True)) & "' " strsql = strsql & " Set string = '" & Trim$(NurseMDI.CommandBars.SaveStateToXMLString(NurseMDI.CommandBars.name)) & "' " strsql = strsql & " WHERE UserID = '" & Trim$(argIDNumber) & "' " strsql = strsql & " AND EXEName = '" & UCase(argEXEName) & "' " End If AdoCn.BeginTrans If ExecADO(strsql) Then AdoCn.CommitTrans Else AdoCn.RollbackTrans End If End Sub
[this is get from saved file]
<CommandBars CompactMode="1"> <Layout> <DockState Version="21" ScreenSize="1280, 1024" Count="2"> <BarInfo0 BarId="1" MRUWidth="32767"/> <BarInfo1 BarId="1694431857" Floating="1" MRUWidth="32767" PointPos="529, 238" MRUDockPos="545, 18, 1113, 44" MRUFloatPos="529, 238"/> </DockState> <DockBars> <DockBar0 Count="3" Id1="1"/> </DockBars> </Layout> </CommandBars>
|