Recent Posts

Tuesday, March 11, 2008

How to Show picture Saved in Database in Vs Flex Grid

'Here Image1 is the image control Placed in the form
Private Sub ShowImage(ByVal intRow As Integer, ByVal intCol As Integer)


Dim rs As ADODB.Recordset
Dim obj As clsPict

On Error GoTo CErr

If Me.grdSearch.Cell(flexcpText, intRow, intCol) <> "" Then


Set obj = New clsPict
Set rsI = New ADODB.Recordset
Set strStream = New ADODB.stream
Set rsI = New ADODB.Recordset
Set rsI = obj.getPicture("PictCode")))
strStream.Type = adTypeBinary
strStream.Open
strStream.Write rsI("picture")
strStream.SaveToFile "C:\Temp.bmp", adSaveCreateOverWrite

Image1.Picture = LoadPicture("C:\Temp.bmp")
Me.grdSearch.Cell(flexcpPicture, Row, 6) = Image1.Picture
Me.grdSearch.Cell(flexcpPictureAlignment, Row, 6) = 9

Exit Sub
CErr:
msgbox( Err.Description)

End Sub


Read more!

Sunday, March 9, 2008

How to Map Drive from Visual Basic 6.0??

How to Map Drive from Visual Basic 6.0??


'Use Reference Windows Script Host Object Model


Public Function MapDrive() As Boolean

Dim drive_letter As String
Dim share_name As String
Dim Password As String
Dim objND As New WshNetwork
On Error GoTo MErr
DoEvents
drive_letter = "X:"

share_name = "file://192.168.10.1/FolderName"
Password = "xyz@password"
objND.MapNetworkDrive drive_letter, share_name, , "userName", Password

MapDrive = True
Set objND = Nothing
Exit Function
MErr:
DisConnect
err.description
Set objND = Nothing
MapDrive = False
Exit Function
End Function



'For Disconnecting


Public Sub DisConnect()

Dim i As Long
Dim objND As New WshNetwork
On Error GoTo DErr
' close the connection with force -> 1
objND.RemoveNetworkDrive "X:"
Set objND = Nothing

Exit Sub
DErr:
Set objND = Nothing
err.description
End Sub


Read more!