Tema: Re: Del Visual Basic skripto
Autorius: Raimis
Data: 2009-08-10 11:36:29
cia "greitukas" . I forma teks isideti button, texbox, label ( defaultiniai vardai nekeisti) ir
pasikoreguoti atitinkamas konstantas, failo pavadinima


Imports Microsoft.VisualBasic.FileIO
Imports System.Text
Imports System.Collections
Imports System.Collections.Specialized

Public Class Form1
    Dim filename As String = "h:\Test.csv"
    Const STULPELIS_ID = 1
    Const STULPELIS_REIKSME = 4
    Const STULPELIU_SKIRTUKAS = ","

    Dim myVal As New StringDictionary()
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.Label1.Text = ""
        Dim fields As String()
        Using parser As New TextFieldParser(filename)
            parser.SetDelimiters(STULPELIU_SKIRTUKAS)

            While Not parser.EndOfData
                ' Read in the fields for the current line
                fields = parser.ReadFields()
                myVal.Add(fields(STULPELIS_ID - 1), fields(STULPELIS_REIKSME - 1))

            End While
        End Using

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myKey As String = Me.TextBox1.Text
        If myVal.ContainsKey(myKey) Then
            Me.Label1.Text = myVal(myKey)
        Else
            Me.Label1.Text = "nera"
        End If
    End Sub
End Class



"Joint_as" <a@a.com> wrote in message news:h5h76g$urc$1@trimpas.omnitel.net...
> Sveiki,
> gal kas gali parasyt paprasta skriptuka MS Visual Basic 2008 EE.
> 
> Formoje tik paieskos laukas + mygtukas ir surandamos reiksmes isvedimas.
> Ieskoma is  .csv failo.
> Ivedama i paieska csv failo eilutes pirmo stulpelio reiksme (id) ir 
> surandama ir isvedama i ekrana pvz. tos eilutes 4 stulpelio reiksme.
> 
> Aciu 
> 
>