home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / apower1a / split.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-26  |  3.5 KB  |  116 lines

  1. VERSION 5.00
  2. Begin VB.Form split_frm 
  3.    Caption         =   "My own 'Split' function !!!"
  4.    ClientHeight    =   2490
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   3735
  8.    Icon            =   "Split.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   2490
  12.    ScaleWidth      =   3735
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.TextBox sep_txt 
  15.       Height          =   285
  16.       Left            =   960
  17.       TabIndex        =   7
  18.       Top             =   480
  19.       Width           =   255
  20.    End
  21.    Begin VB.CommandButton effac_cbt 
  22.       Caption         =   "&Reset"
  23.       Height          =   255
  24.       Left            =   1440
  25.       TabIndex        =   6
  26.       Top             =   480
  27.       Width           =   975
  28.    End
  29.    Begin VB.ListBox result_lst 
  30.       Height          =   1230
  31.       ItemData        =   "Split.frx":000C
  32.       Left            =   120
  33.       List            =   "Split.frx":000E
  34.       TabIndex        =   3
  35.       TabStop         =   0   'False
  36.       Top             =   840
  37.       Width           =   3495
  38.    End
  39.    Begin VB.CommandButton decoup_cbt 
  40.       Caption         =   "&Split !!!"
  41.       Height          =   255
  42.       Left            =   2640
  43.       TabIndex        =   5
  44.       Top             =   480
  45.       Width           =   975
  46.    End
  47.    Begin VB.TextBox chaine_txt 
  48.       Height          =   285
  49.       Left            =   720
  50.       TabIndex        =   1
  51.       Top             =   120
  52.       Width           =   2895
  53.    End
  54.    Begin VB.Label sep_lbl 
  55.       Caption         =   "Seperator"
  56.       Height          =   255
  57.       Left            =   120
  58.       TabIndex        =   2
  59.       Top             =   510
  60.       Width           =   735
  61.    End
  62.    Begin VB.Label chaine_lbl 
  63.       Caption         =   "String"
  64.       Height          =   255
  65.       Left            =   120
  66.       TabIndex        =   0
  67.       Top             =   150
  68.       Width           =   495
  69.    End
  70.    Begin VB.Label nb_elem_lbl 
  71.       Alignment       =   2  'Center
  72.       Appearance      =   0  'Flat
  73.       BorderStyle     =   1  'Fixed Single
  74.       ForeColor       =   &H80000008&
  75.       Height          =   255
  76.       Left            =   120
  77.       TabIndex        =   4
  78.       Top             =   2160
  79.       Width           =   3495
  80.    End
  81. Attribute VB_Name = "split_frm"
  82. Attribute VB_GlobalNameSpace = False
  83. Attribute VB_Creatable = False
  84. Attribute VB_PredeclaredId = True
  85. Attribute VB_Exposed = False
  86. Option Explicit
  87. Private Sub Form_Load()
  88.     Call effac_cbt_Click
  89. End Sub
  90. Private Sub decoup_cbt_Click()
  91.     On Error GoTo erreur
  92.     Dim tableau_a_remplir() As String
  93.     Dim rep As Integer, nombre_elements  As Integer, i As Integer
  94.     rep = split(chaine_txt.Text, sep_txt.Text, tableau_a_remplir(), nombre_elements)
  95.     If rep <> 0 Then GoTo erreur
  96.     result_lst.Clear
  97.     For i = 0 To nombre_elements - 1
  98.         result_lst.AddItem tableau_a_remplir(i)
  99.         result_lst.ListIndex = result_lst.ListCount - 1
  100.     Next i
  101.     nb_elem_lbl.Caption = "This string contains " & nombre_elements & " elements."
  102. Exit Sub
  103. erreur:
  104.     MsgBox "Error n
  105. " & rep & vbCrLf & Error(rep), vbCritical, "Error"
  106. End Sub
  107. Private Sub effac_cbt_Click()
  108.     chaine_txt.Text = "This" & Chr(127) & "is" & _
  109.     Chr(127) & "my" & Chr(127) & "version" & _
  110.     Chr(127) & "of" & Chr(127) & "the" & _
  111.     Chr(127) & "Split" & Chr(127) & "fonction"
  112.     sep_txt.Text = Chr(127)
  113.     result_lst.Clear
  114.     nb_elem_lbl.Caption = vbNullString
  115. End Sub
  116.