|
-
Feb 25th, 2006, 02:02 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] 2 confusing Que. (both solved by jcis)
Hello All,
1) I have made word file as user manual of my application & I want to add it in my project (MDI form's Help menu), so howcan I do that ?
2) Is there we can write committrans & rollback for ADO & How ?
Last edited by shirishdawane; Feb 25th, 2006 at 04:42 AM.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 02:10 AM
#2
Re: 2 confusing Questions
 Originally Posted by shirishdawane
2) Is there we can write committrans & rollback for ADO & How ?
VB Code:
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = "Your connection string"
cn.Open
'Then you can use these..
cn.BeginTrans
cn.CommitTrans
cn.RollbackTrans
-
Feb 25th, 2006, 02:13 AM
#3
Thread Starter
Hyperactive Member
Re: 2 confusing Questions
Suppose I am adding new record in multiple linked tables in one shot & data saved into 1st table but due to error unable to save into 2nd table then can cn.Rollback undo changes done into table1 ?
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 02:30 AM
#4
Re: 2 confusing Questions
 Originally Posted by shirishdawane
Suppose I am adding new record in multiple linked tables in one shot & data saved into 1st table but due to error unable to save into 2nd table then can cn.Rollback undo changes done into table1 ?
Yes, you can. General idea:
VB Code:
Private Sub ExecuteTransaction()
Dim cn As ADODB.Connection
Dim blnTransOpen As Boolean
Dim ConnectionLiving As Boolean
On Error GoTo ErrHandler
blnTransOpen = False
ConnectionLiving = False
Set cn = New ADODB.Connection
cn.ConnectionString = "Your connection string"
cn.Open
ConnectionLiving = True
cn.BeginTrans
blnTransOpen = True
cn.Execute "Insert Into Table1..."
cn.Execute "Insert Into Table2..."
cn.CommitTrans
blnTransOpen = False
cn.Close
ConnectionLiving = False
Set cn = Nothing
Exit Sub
ErrHandler:
If blnTransOpen Then
cn.RollbackTrans
MsgBox "Error when trying to Insert data", vbOKOnly + vbCritical, "Error:"
End If
If ConnectionLiving Then
cn.Close
Set cn = Nothing
End If
End Sub
Last edited by jcis; Feb 25th, 2006 at 02:38 AM.
-
Feb 25th, 2006, 02:39 AM
#5
Thread Starter
Hyperactive Member
2 confusing Questions(1 solved)
Thanx jcis , but what about 1st que. ? if you know the answer, ofcourse.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 02:45 AM
#6
Re: 2 confusing Questions(1 solved)
I think you need OLE to add a Word document to your Form, I never used Ole, just opened word or Excel files from VB, but that's different than what you need.
Maybe it's not a good idea to add a word document, If I would have to add help to my program, I would use a RichTextBox, it accepts Formatting, or maybe the Advanced label control that Joacim Andersson added to VB Codebank.
I think the real problem about Word, besides that OLE insertion you need, is that it won't work if the user hasn't word installed in that PC.
Last edited by jcis; Feb 25th, 2006 at 02:48 AM.
-
Feb 25th, 2006, 02:47 AM
#7
Thread Starter
Hyperactive Member
Re: 2 confusing Questions(1 solved)
Thanx for your valuable information.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 02:49 AM
#8
Re: 2 confusing Questions(1 solved)
 Originally Posted by shirishdawane
Thanx for your valuable information. 
You're welcome
-
Feb 25th, 2006, 03:00 AM
#9
Thread Starter
Hyperactive Member
Re: 2 confusing Questions(1 solved)
[QUOTE=jcis]Maybe it's not a good idea to add a word document, If I would have to add help to my program, I would use a RichTextBox, it accepts Formatting, or maybe the Advanced label control that Joacim Andersson added to VB Codebank./QUOTE]
Hello jcis but I have searched Code Bank forum but unable to find thread which you have mentioned if you know the link then please sende it across.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 04:01 AM
#10
Re: 2 confusing Questions(1 solved)
 Originally Posted by shirishdawane
Hello jcis but I have searched Code Bank forum but unable to find thread which you have mentioned if you know the link then please sende it across. 
Ok, this is the thread..
http://www.vbforums.com/showthread.php?t=379724
But now I realize that you'll need to scroll your document and don't know if that control supports scrolling. You can do it if you use a RichTextBox.
I think a Richtextbox would be the best option then, but I've just tryied to insert an OLE object and it's easy, but again, I don't know how it should be programmed to be scrolled.If you want to try, just select the OLE component in the tool window and drag it to your Form, it will show its properties, then select browse, and select your DOC file there.
Last edited by jcis; Feb 25th, 2006 at 04:05 AM.
-
Feb 25th, 2006, 04:41 AM
#11
Thread Starter
Hyperactive Member
Re: 2 confusing Questions(1 solved)
 Originally Posted by jcis
I don't know how it should be programmed to be scrolled.
I have done as per you have said & geuss what when you double click on OLE object at runtime then linked Word file is getting open. So no need to write anything for OLE object scrolling.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 04:55 AM
#12
Re: [RESOLVED] 2 confusing Que. (both solved by jcis)
The RichTextBox is the best option, this will open and show your word documents with scrollbars..
1) In word, save your documents as RTF, it gives you that option when you click Save As..
2) Add Microsoft Rich TextBox control 6.0 to your project. Drag it to the form and in Scrollbars property select both. Right click the control, properties and select From File, there you load your RTF file.
That's all, you don't even need code, and you can use that documents you created with Word.
EDIT Oh ok, you did it with OLE, you can try also this option to see how it works, then use the one you like the most.
Last edited by jcis; Feb 25th, 2006 at 05:02 AM.
-
Feb 25th, 2006, 05:05 AM
#13
Thread Starter
Hyperactive Member
Re: [RESOLVED] 2 confusing Que. (both solved by jcis)
Hey jcis really thanx from heart, today I really learn so many things from you. Keep guiding in future also. Thank you once again.
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
Feb 25th, 2006, 05:10 AM
#14
Re: [RESOLVED] 2 confusing Que. (both solved by jcis)
You're welcome mate 
ps: I forgot, set RichTextBox's Locked property to True, so the control won't be editable for users.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|