Program using OLE
Container control:
1. Select OLE control in Toolbox.
2. Place the control on the form with the required size.
3. As soon as OLE control is placed on the form, Insert
Object Dialog is displayed to allow you to either embed or link an object
into OLE Container.
4. The available options in insert dialog are - Create
New, where you select an Object Type and create an object using the
appropriate application, or Create from File, where you can create an
object by selecting a file from file system.
To embed a word document
into OLE Container control:
1. In Insert Object Dialog box select Create
from File radio button.
2. Click on Browse button and select a document
file. Click on Ok
3. An object is embedded into OLE Container control and a
part of document is displayed.
4. Run the project using F5.
5. Double click on OLE Container control. This action
will invoke MS-Word and run it in OLE Container control. When OLE Server runs
in OLE Client, it is called as In-Place Activation.
6. Make necessary changes using MS-Word.
7. Press ESC key to come out of In-Place activation.
Application for OLE drag
and drop manually:
1. Start a new project using File-> New Project
and select Standard EXE as the type of the project.
2. Place two textboxes along with labels and a command
button.
3. Arrange the controls on the form in a neat format.
4. Change the following properties.
Object
|
Property
|
Value |
Label1
|
Caption
|
Source
|
Text1
|
Name
|
txtsource
|
|
Text
|
""
|
|
OLEDragMode
|
0-Manual
|
|
OLEDropMode
|
2-Automatic.
|
Text2
|
Name
|
txtTarget
|
|
Text
|
""
|
|
OLEDragMode
|
1-Automatic
|
|
OLEDropMode
|
1-Manual
|
Form
|
Caption
|
OLE
Drag and Drop
|
Command1
|
Name
|
Cmdend
|
|
Caption
|
&END
|
DESIGN VIEW:
CODING:
Private Sub cmdend_Click()
End
End Sub
Private Sub
txtsource_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As
Single)
' start OLE dragging
txtsource.OLEDrag
End Sub
Private Sub
txtsource_OLECompleteDrag(Effect As Long)
If (Effect And vbDropEffectMove) <> 0
Then ' bitwise Anding
txtsource.Text = ""
End If
End Sub
Private Sub
txtsource_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
' set allowed effects
AllowedEffects = vbDropEffectMove Or
vbDropEffectCopy
Data.SetData UCase(txtsource.Text)
End Sub
Private Sub
txttarget_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer,
Shift As Integer, X As Single, Y As Single)
Txttarget.Text = Data.GetData(vbCFText)
Effect = vbDropEffectMove
End Sub
1. Design the form.
2. Create a command Button
named as a Command1 and copy that and paste it 10 times. This will create a
control array.
3. Create a cmdoperator
control array using another Command Button named as Command2.
4. Place Command Button named
as Command3 and set its caption to ‘clear’.
5. Place Command Button named
as Command4 and set its caption to ‘=’.
6. place a Textbox for the
Display.
DESIGN VIEW:
CODING:
Private lastoperator As
String
Private firstpart As String
Private Sub Form_Load()
TxtResult.Enabled = False
Me.KeyPreview = True
End Sub
Private Sub
Form_KeyDown(KeyCode As Integer, Shift As Integer)
'number in main keyboard
If (KeyCode >= 48 And
KeyCode <= 57) Then
addDigits (Chr(KeyCode))
End If
'numbers in numpad
If (KeyCode >= 96 And
KeyCode <= 105) Then
addDigits (Chr(KeyCode - 48))
End If
'if backspace
If (KeyCode = 8) Then
If (TxtResult.Text <>
"") Then
TxtResult.Text =
Left(TxtResult.Text, Len(TxtResult.Text) - 1)
End If
End If
'for various operators
If (KeyCode = 111) Then
registerOperator ("/")
If (KeyCode = 106) Then
registerOperator ("*")
If (KeyCode = 109) Then
registerOperator ("-")
If (KeyCode = 107) Then registerOperator
("+")
End Sub
Private Sub
cmdoperator_Click(Index As Integer)
registerOperator
(cmdoperator(Index).Caption)
End Sub
Private Sub cmdclear_Click()
firstpart = ""
lastoperator = ""
TxtResult.Text = ""
End Sub
Private Sub Cmdequals_Click()
Select Case lastoperator
Case Is = "+"
TxtResult.Text = firstpart -
TxtResult.Text + TxtResult.Text + TxtResult.Text
Case Is = "-"
TxtResult.Text = firstpart -
TxtResult.Text
Case Is = "/"
TxtResult.Text = firstpart /
TxtResult.Text
Case Is = "*"
TxtResult.Text = firstpart *
TxtResult.Text
End Select
firstpart = ""
lastoperator = ""
End Sub
Private Sub
Command1_Click(Index As Integer)
addDigits
(Command1(Index).Caption)
End Sub
Private Sub addDigits(Digit
As String)
TxtResult.Text =
TxtResult.Text & Digit
End Sub
Private Sub
registerOperator(Operatortext As String)
lastoperator = Operatortext
firstpart = TxtResult.Text
TxtResult.Text = ""
End Sub
Program to Handle
Horizontal Scrollbar & Vertical Scrollbar:
Control
|
Property
|
Value
|
Vscroll 1
|
Min
|
1
|
Vscroll 1
|
max
|
100
|
Vscroll 1
|
Large change
|
10
|
Vscroll 1
|
Small change
|
1
|
Vscroll 1
|
value
|
50
|
Hscroll 1
|
Min
|
1
|
Hscroll 1
|
Max
|
100
|
Hscroll 1
|
Large change
|
10
|
Hscroll 1
|
Small change
|
1
|
Hscroll 1
|
value
|
50
|
Text 1
|
Font
|
MS Sans Serif, 12
|
Command 1
|
Caption
|
End
|
CODING:
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
VScroll1.Min = 1
VScroll1.Max = 100
VScroll1.LargeChange = 10
VScroll1.SmallChange = 1
VScroll1.Value = 50
HScroll1.Min = 1
HScroll1.Max = 100
HScroll1.LargeChange = 10
HScroll1.SmallChange = 1
HScroll1.Value = 50
End Sub
Private Sub HScroll1_Change()
Text1.Text =
"horizontalsetting:" & Str(HScroll1.Value)
End Sub
Private Sub VScroll1_Change()
Text1.Text =
"verticalsetting:" & Str(VScroll1.Value)
End Sub
OUTPUT:
It was a very good post indeed. I thoroughly enjoyed reading it in my lunch time. Will surely come and visit this blog more often. Thanks for sharing.substance abuse evaluation near me
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteIn 2013, Chris Hemsworth net worthacquired a palatial estate nestled in Malibu’s prestigious Point Dume neighborhood for a princely sum of $4.8 million. Surpassing all expectations, he later sold this exquisite abode for a staggering $7 million, a testament to his astute investment acumen.
ReplyDeleteGreat knowledge, do anyone mind merely reference back to it Its great to talk about the best campbell football.
ReplyDeleteThank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information. Love to talk about the best cheap yachts for sale.
ReplyDeleteI really appreciate you providing this excellent blog.incredibly motivating and beneficial as well.I hope you will keep sharing your thoughts.Without a doubt, I will adore reading. I enjoy discussing the greatest automatic transmission fluid.
ReplyDeleteOne of the critical concerns for users, both prescribed and recreational, is How Long Does Adderall Stay in Your System. In this article, we’ll discuss the factors affecting Adderall’s duration in the body, detection windows in various tests, and how it metabolizes.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete