폴더 목록 가져오기 / 최소값 찾기
*
Imports System.IO

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Integer = 0
Dim array(90) As String
For Each foundDir As String In My.Computer.FileSystem.GetDirectories("D:\새 폴더")

Dim fi As New IO.DirectoryInfo(foundDir)

ListBox1.Items.Add(fi.Name)

' array(x) = fi.Name.ToString


x += 1

Next


End Sub
End Class

dsa.GIF

 

이 게시물을

댓글'3'

            If fi.Name.Length = 8 Then

                ListBox1.Items.Add(fi.Name)

            End If

 

문자열 길이 가 8인 것만 입력 받기

이 댓글을

문자열을 숫자로 변환

Imports System.IO

 

Public Class Form1

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim x As Integer = 0

        Dim myval As Integer

        For Each foundDir As String In My.Computer.FileSystem.GetDirectories("D:\새 폴더")

 

            Dim fi As New IO.DirectoryInfo(foundDir)

 

            If fi.Name.Length = 8 Then

                Dim mm As Integer = Val(fi.Name)

                myval = mm + x

                ListBox1.Items.Add(myval)

            End If

            x += 10

        Next

 

 

    End Sub

End Class

이 댓글을

Imports System.IO

 

Public Class Form1

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim x As Integer = 0

        Dim arrayInterger(90) As Integer

        For Each foundDir As String In My.Computer.FileSystem.GetDirectories("D:\새 폴더")

 

            Dim fi As New IO.DirectoryInfo(foundDir)

 

            If fi.Name.Length = 8 Then

                Dim mm As Integer = Val(fi.Name)

                ListBox1.Items.Add(mm)

                arrayInterger(x) = mm

                x += 1

            End If

 

        Next

 

        If x > 1 Then

            Dim ValTemp As Integer = arrayInterger(0)

            For xx As Integer = 1 To x - 1

                If ValTemp > arrayInterger(xx) Then

                    ValTemp = arrayInterger(xx)

                End If

            Next

            Label1.Text = "최소값 : " & ValTemp.ToString

        End If

 

    End Sub

End Class

 

aa.GIF

 

이 댓글을

공유하기

SEARCH

MENU NAVIGATION