none
Imbibe VB codes RRS feed

  • Question

  • Hi Rockstars,

    I m new to vb can some one post some useful codes(unique)?

    I will rate to all my friends who helps me.

     

    Waiting...

    Saturday, April 7, 2007 4:50 PM

All replies

  • Just tell me that of what type, you want codes. I'm asking this as VB itself is very vast. The other way round is, that I can post codes for any category. If that will do, just tell me here.
    Friday, April 13, 2007 12:51 PM
  • Ya sanket, 

    any type of code.

     

    waiting for reply...

     

    Friday, April 13, 2007 4:53 PM
  • if you think VB.NEt can serve your purpose then i can help you.

    for example just poen a new project and then open windows application.

    drag-& drop a button and drag-and drop a textbox onto your form then

    double-click button code file appear and here in button-clicked procedure write code as:

    textbox1.text="HELLO DEEPAK", now press f5 when your form runs

    and u click the button then hELLO DEPAK appears in textbox

    this code will work in VB as well as in VB.NET

    Sunday, April 15, 2007 6:47 PM

  • Here goes the code for Exporting SQL Data to CSV File :

    Public Function CSVExport(db As DAO.Database, sSQL As String, sDest As String) As Boolean

       Dim record        As Recordset
       Dim nI            As Long
       Dim nJ            As Long
       Dim nFile         As Integer
       Dim sTmp          As String
      
       On Error GoTo Err_Handler
      
       Set record = db.OpenRecordset(sSQL, DAO.dbOpenDynaset, DAO.dbReadOnly)
      
       ' *** Open output file
       nFile = FreeFile
      
       Open sDest For Output As #nFile
      
       ' *** Export fields name
       For nI = 0 To record.Fields.Count - 1
          sTmp = "" & (record.Fields(nI).Name)
          Write #nFile, sTmp;
       Next
       Write #nFile,

       If record.RecordCount > 0 Then
          record.MoveLast
          record.MoveFirst
      
          For nI = 1 To record.RecordCount
             For nJ = 0 To record.Fields.Count - 1
                sTmp = "" & (record.Fields(nJ))
                Write #nFile, sTmp;
             Next
             Write #nFile,
             record.MoveNext
          Next
       End If
      
       Close #nFile
       CSVExport = True
      
       Exit Function
      
    Err_Handler:
       MsgBox ("Error: " & Err.Description)

       CSVExport = False
      
    End Function

    Sunday, April 15, 2007 8:37 PM
  • Hello Sanket ,

    thanks for ur response

     

    but can u tell me what is a csv file in details

    Wednesday, April 18, 2007 6:17 PM
  • Hey Sanket ,

    what happened not interested in my queries?

    Friday, April 20, 2007 5:49 PM