jhai_salvador 48 Junior Poster

do not hardcode your database path.

Just make your setup structure like this:

App.exe (your compiled app)
database\db.mdb (your database)

Then on your code where you connect to database, you can do it like this:
App.path & "\database\db.mdb"

thats it. hope it helps.

jhai_salvador 48 Junior Poster

Add the snippet in your module.

Requirements:

  • Make sure you have reference to M$ ActiveX Data Objects Library (ADODB)
  • A table field with OLE Object / BLOB as datatype
  • A recordset that is already oppened and ready to be use

To save Image on your table field, call SetRSBlob function

Make sure that your recordset is already loaded or openned

Lets assume that our recordset rs is already oppened and ready to be updated.

Dim ret as Boolean
ret = SetRSBlob("C:\image1.jpg", rs, "image")

TRUE will be returned if image was set to the recordset field.

All you have to do is call recordset rs.update function to save it permanently to the table.

To extract the image, just call the ExtractBlob function

Again, make sure that your recordset is already openned.

Dim ret as Boolean
ret = ExtractBlob(rs, "image", "c:\extracted_image.jpg")

It will return true if image was extracted successfully.

Code is not that clean but I hope anyone can enjoy and learn something on it.

I used this code on my church management software which you can download on my website http://silentprojectsoftwares.com/ :) (I hope I will not get banned for posting my site.. haha)

Anyway, enjoy and have a happy coding..

Peace out.. :)

jhai_salvador 48 Junior Poster

Indeed. I voted!!

Thank you very much ;)

Anyone, please do vote VB Classic to be improved: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3440221-bring-back-classic-visual-basic-an-improved-versi

jhai_salvador 48 Junior Poster

Hi!

I don't know where to post this, but since this is vb6 thread i'll just post it here.

I need all of your support by voting Visual Basic Classic to be improved. here is the link: Bring back Classic Visual Basic, an improved version of VB6

To vote:
Click the vote button and Choose 3 and thats it. No need to register. We need a lot of votes so spread the word about it.

Thank you,

AndreRet commented: I voted. I agree with most of the posts there as well. +13
jhai_salvador 48 Junior Poster

This is a sample code.

'For loop
dim i as integer
for i = 0 to 5
    debug.print i
next

'while loop
dim i as integer
i = 0
while i <> 5
    i = i + 1
    debug.print i
loop
jhai_salvador 48 Junior Poster

You don't have to unload it, as what the person said above me, you can set the 2nd form as Modal when SHOWing.

Private Sub Command1_Click()
   frm2.Show vbModal, Me
End Sub
ulrichrandom commented: thank you very much. i will try this. Follow up question. after i'm done with frm2, how do i get back with the previous form? do i use unload me or something? thank you again. :) +0
jhai_salvador 48 Junior Poster

This is what Im using on my crystal report 8.5.

Reports are created and connected via odbc so database location can be easily change.

Dim crxTable As CRAXDRT.DatabaseTable
Dim mReport As CRAXDRT.Report

For Each crxTable In mReport.Database.Tables

 '* Use to Connect via ODBC,
 '* crxTable.SetLogOnInfo(pServerName As String, [pDatabaseName], [pUserID], [pPassword])

 crxTable.SetLogOnInfo "ODBCName", "db.mdb", "admin", "passwordgoeshere"
 DoEvents
Next
jhai_salvador 48 Junior Poster

Hi!

This is my submission for code snippet contest.
I also posted this code to help other members on how they can use compact & repair their MS Access Database within Visual Basic 6.0.

You also need to add Microsoft Jet and Replication 2.6 in your project reference.

To use, add the snippet in Module;

Once you have added it to the module just call CompactAccess with database location and its password like this;

Call CompactAccess("C:\Database.mdb", "12345")

I also attached a sample project on how you can use it, just check it out.

Click Here

Please note that the database should be close before compacting it, else it will not work.

Thanks,

Dani commented: Good luck! +0
AndreRet commented: Nice Snippet Jhai +12
jhai_salvador 48 Junior Poster

ISP IP? or your IP Address?

You can use is use M$ winsock control; Try it,

put winsock on form, then add this code in form load event;

   Debug.Print Winsock1.LocalIP

then check your immediate window, you will see your IP Address (Same address that you can see on http://www.whatismyip.net/)

lmpush commented: Thanks for your reply. As per this coding it is showing the local machine ip only. i want to know my internet service provider IP Address. +0
jhai_salvador 48 Junior Poster

In the design time, you must make your form Splash Border Style property to None so it cant be moved out or minimized. You can also show your splash as modal window like this

splash.show vbModal, Me

But make sure you have a timer event make your splash form unload automatically, or unload when user click on the splash screen form.

Happy coding...

jhai_salvador 48 Junior Poster

If you want your assignment to be done completely then you can post your project at vworker.com. This will cost you but if you really need a complete source then try it! ;)

Post a Project for me Then I will be glad to give you a complete source ;)

jhai_salvador 48 Junior Poster

Forgot to remove it :D

here it is Again w/o the exe....

peter_budo commented: Good job +16
jhai_salvador 48 Junior Poster

You can use loops

dim i as integer
dim myString as string

for i = 1 to len(text1.text)
 if mid(text1.text,i,1) <> " " then
 myString = myString & mid(text1.text)
 endif
next i

you can do something like that. Thanks

AndreRet commented: Nice alternative. +4
jhai_salvador 48 Junior Poster

This is my Cogwheel Encryption Method to encrypt and decrypt strings.

Wheel1 is Replace by Wheel2 when Encrypting and Wheel2 is Replace by wheel1 when you are decrypting...

To Encrypt a string, just call the EncryptString function

Text2.Text = EncryptString(Text1.Text)

To Decrypt a string, just call the DecryptString function

Text2.Text = DecryptString(Text1.Text)

This is my First Code Snippet so hope you like it.

AndreRet commented: Nice for a first time post Jhai. +3
jhai_salvador 48 Junior Poster

if you just need to open it, you can use SHELL in vb, something like this...

Shell YourVBSFile, vbMaximizedFocus