Rabu, 16 November 2011

File and directory

Jika Anda pemrograman di VB, harus ada banyak masalah bila Anda ingin memanipulasi file dan direktori. Jangan khawatir! Pada bagian ini, Anda dapat menemukan contoh yang Anda butuhkan. Misalnya, mengubah ekstensi file dari cek file jika file, direktori, atau keluar berkendara, jumlah file dan folder. . . Jangan ragu! Check it out sekarang!

Senin, 14 November 2011

pendahuluan DAO

When Visual Basic first started working with databases, it used the Microsoft Jet database engine, which is what Microsoft Access uses. Using the Jet engine represented a considerable advance for Visual Basic, because now you could work with all kinds of data formats in the fields of a database: text, numbers, integers, longs, singles, doubles, dates, binary values, OLE objects, currency values, Boolean values, and even memo objects (up to 1.2GB of text). The Jet engine also supports SQL, which database programmers found attractive.
To support the Jet database engine, Microsoft added the data control to Visual Basic, and you can use that control to open Jet database (.mdb) files. Microsoft also added a set of Data Access Objects (DAO) to Visual Basic:
  DBEngine—The Jet database engine
  Workspace—An area can hold one or more databases
  Database—A collection of tables
  TableDef—The definition of a table
  QueryDef—The definition of a query
  Recordset—The set of records that make up the result of a query
  Field—A column in a table
  Index—An ordered list of records
  Relation—Stored information about the specific relationship between tables
We’ll work with these Data Access Objects in the next chapter; in this chapter, we’ll work with the data control.

Apa Itu Database?

A database is a collection of information, or data, arranged in a particular manner. The basic unit of information in a database is called a record. Each record in a database contains two or more fields that hold specific types of information. Perhaps the most common example of a database is an address list. Each entry in the database constitutes one record: an individual’s name and address information. Each record in the database contains fields that hold separate items of information: first name, last name, address, city, and so on. These fields are the same for every record in the database, and they are assigned names identifying the data they contain.

A database is sometimes displayed in row and column format. Each row contains one record, and each column contains one field, as illustrated in Figure 19.1. In this case, a single record can be referred to as a row, and an individual field as a column. The entire collection of records is called a table. Some databases contain more than one table, with the records in each table having a different field structure. We will deal with multiple-table databases in later chapters; for now, we’ll stick to single-table databases.

A database program is designed to let you work with the information in a database. Some capabilities are common to any database program—adding, finding, and deleting records, for example. Many other capabilities are customized to fit a specific program. In an address list database, for example, you may want the ability to print envelopes and sort the records by ZIP code. A graphics database might need the ability to input and store images from a scanner. The possibilities are endless. If you write database programs as part of your job, you never know what someone might ask you to do next. Here’s one of the advantages of Visual Basic: As a full-featured programming language, it offers the flexibility to build many capabilities right into the database program. Thanks to its database tools, most of the fundamental database tasks are simple to accomplish.

Sabtu, 12 November 2011

Convert Seconds to Days, Hours, Minutes, Seconds

' Duration
' By Quentin Zervaas [zervaas@strangeness.org]
' Use at will! Works as well as (better!) than mIRC's
' $duration function
' since it gives you multiple output options
' It's pretty easy to add more of your own
'depending on how you want it.
'
' Just add new cases, and define the strings accordingly
'(remember to allow spaces too.

Public Function Duration(TotalSeconds As Long, UpFormat As _
    Integer) As String
 
  ' Format = 0, 1, 2
  ' This determines the format of the time to be returned
  ' Type 0: 1d 4h 15m 47s
  ' Type 1: 1 day, 4:15:47
  ' Type 2: 1 day 4hrs 15mins 47secs
  ' Type else: Defaults to type 0
 
  Dim Seconds
  Dim Minutes
  Dim Hours
  Dim Days
  Dim DayString As String
  Dim HourString As String
  Dim MinuteString As String
  Dim SecondString As String
 
  Seconds = Int(TotalSeconds Mod 60)
  Minutes = Int(TotalSeconds \ 60 Mod 60)
  Hours = Int(TotalSeconds \ 3600 Mod 24)
  Days = Int(TotalSeconds \ 3600 \ 24)

  Select Case UpFormat
    Case 0
      DayString = "d "
      HourString = "h "
      MinuteString = "m "
      SecondString = "s"
    Case 1
      If Days = 1 Then DayString = " day, " _
      Else: DayString = " days, "
      HourString = ":"
      MinuteString = ":"
      SecondString = ""
    Case 2
      If Days = 1 Then DayString = " day " _
      Else: DayString = " days, "
      If Hours = 1 Then HourString = "hr " _
      Else: HourString = "hrs "
      If Minutes = 1 Then MinuteString = "min " _
      Else: MinuteString = "mins "
      If Seconds = 1 Then SecondString = "sec " _
      Else: SecondString = "secs"
    Case Else
      DayString = "d "
      HourString = "h "
      MinuteString = "m "
      SecondString = "s"
  End Select
 
  Select Case Days
    Case 0
      Duration = Format(Hours, "0") & HourString & _
            Format(Minutes, "00") & MinuteString & _
             Format(Seconds, "00") & SecondString
    Case Else
      Duration = Days & DayString & _
          Format(Hours, "0") & HourString & Format _
          (Minutes, "00") & MinuteString & _
           Format(Seconds, "00") & SecondString
    End Select
                
End Function

Jumat, 11 November 2011

Convert a Decimal Number to Binary

Private Function CBin(Number As Integer) As String
Dim Temp As Variant
Temp = 1 'Can't fouble nothing
Do Until Temp > Number 'sets starting point for Len
    Temp = Temp * 2
Loop
Do Until Temp < 1
    If Number >= Temp Then
       CBin = CBin + "1"
       Number = Number - Temp
    Else
        CBin = CBin + "0"
    End If
    Temp = Temp / 2
Loop 'Loop until string is complete
CBin = CStr(Val(CBin))
End Function

Kamis, 10 November 2011

Interpolasi

'********************************************************
'This function will return the linear interpolated value for dblFindIndex
'
'  *------------+-----*
'  a               c      b
'  1               3     5
'  10             x      50
'
' To find x at c the correct syntax would be:
' x = Interpolate(1,10,5,50,3)
' and the answer would be 30
'********************************************************
' Passing a value of true for boolExtrapolate will switch on
' extropolation if find index falls outside the bounds of index1
' and index2.
'********************************************************

Private Function Interpolate(ByVal dblIndex1 As Double, _
  ByVal dblValue1 As Double, ByVal dblIndex2 As Double, _
  ByVal dblValue2 As Double, ByVal dblFindIndex As Double, _
  Optional boolExtrapolate As Boolean = True) As Double
'Trap Errors
On Error GoTo Interpolate_Error

Dim dblUpperLimitIndex As Double
Dim dblUpperLimitValue As Double
Dim dblLowerLimitIndex As Double
Dim dblLowerLimitValue As Double

'Main Function
    If Not boolExtrapolate Then
        'We are not extrapolating so cap the returned values
       
        If dblIndex2 > dblIndex1 Then
            dblLowerLimitIndex = dblIndex1
            dblUpperLimitIndex = dblIndex2
            dblLowerLimitValue = dblValue1
            dblUpperLimitValue = dblValue2
        Else
            dblLowerLimitIndex = dblIndex2
            dblUpperLimitIndex = dblIndex1
            dblLowerLimitValue = dblValue2
            dblUpperLimitValue = dblValue1
        End If
       
        If dblFindIndex <= dblLowerLimitIndex Then
            'If FindIndex is less than or equal to index1,
             'return value will allways be Value1
            Interpolate = dblLowerLimitValue
            GoTo Interpolate_Exit
        ElseIf dblFindIndex >= dblUpperLimitIndex Then
            'If FindIndex is greater than or equal to index2,
            'return value will allways be Value2
            Interpolate = dblUpperLimitValue
            GoTo Interpolate_Exit
        End If
   
    End If
   
    'Perform the interpolation
    Interpolate = dblValue1 + (dblValue2 - dblValue1) * _
     (dblFindIndex - dblIndex1) / (dblIndex2 - dblIndex1)

'Exit
Interpolate_Exit:
    Exit Function

'Error Handling
Interpolate_Error:
    Dim Error_Location As String
    Error_Location = "Interpolate"
    MsgBox Err.Description, vbExclamation, _
          Error_Location & ":" & Err.Number
    Interpolate = 0
    GoTo Interpolate_Exit
 
End Function

Rabu, 09 November 2011

Date and math

Dalam kategori ini, ada banyak contoh kode yang menyadari bahwa beberapa fungsi yang berguna dan penting dalam matematika, seperti menghasilkan bilangan prima dan aplikasi kalkulator sederhana, dll Selain itu, kami telah mengumpulkan beberapa kode mengacu pada fungsi tanggal untuk Anda, misalnya , perhitungan astronomi dan tanggal program, kalender untuk bulan antara tahun 1899 ke tahun 2101, kalender yang dapat diperpanjang untuk penjadwal dll
  • Date :

Senin, 07 November 2011

Data Base

Ketika Anda membutuhkan pemrograman dengan database, Anda bisa mendapatkan beberapa bantuan dalam bagian ini. Kami mengumpulkan banyak kode VB yang berhubungan dengan database, seperti beberapa aplikasi dari ADO, data alat wartawan, kontrol yang berguna dalam database. . . Dalam satu kata, Anda dapat menemukan kode yang Anda butuhkan!
If you need an immediate solution to:
Creating And Managing Databases With The Visual Data Manager
Creating A Table With The Visual Data Manager
Creating A Field With The Visual Data Manager
Entering Data In A Database With The Visual Data Manager
Adding A Data Control To A Program
Opening A Database With The Data Control
Connecting A Data Control To A Bound Control
Registering An ODBC Source
Opening A Database With A Remote Data Control
Connecting A Remote Data Control To A Bound Control
Opening A Database With An ADO Data Control
Connecting An ADO Data Control To A Bound Control
The Data Form Wizard: Creating A Data Form
Using Database Control Methods: Adding, Deleting, And Modifying Records
Adding Records To Databases
Deleting Records In Databases
Refreshing A Data Control
Updating A Database With Changes
Moving To The Next Record
Moving To The Previous Record
Moving To The First Record
Moving To The Last Record
The Data-Bound Controls: From Text Boxes To Flex Grids
The ADO Data-Bound Controls

  1. Apa itu Database?? 
  2. Pendahuluan DAO
  3. Membuat DB dengan VDManager

Jumat, 04 November 2011

Sambutan

Bismillahirrahmanirrahim....
dengan rahmat tuhan, blog ini telah saya buat semoga bisa membawa manfaat bagi kebaikan bersama, amien...