Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

cagueca

[Resolvido] Erro no programa ..

Recommended Posts

cagueca

Boas:

Ando a tentar fazer um programa tipo cpuz  :cheesygrin: mas como estou a comecar agora empanquei ..

Da me erro (A conversão da cadeia "A:\, C:\, D:\, E:\, F:\" para o tipo 'Integer' não é válida) na ultima label para ir buscar as drives c: d: etc ..

vou por o codigo ..

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

        Label1.Text = Environment.UserName
        Label2.Text = System.DateTime.Now.ToShortDateString()
        Label3.Text = My.Computer.Info.OSFullName
        Label4.Text = My.Computer.Info.OSVersion
        Label5.Text = TimeOfDay.ToLongTimeString()
        Label6.Text = My.Computer.Info.TotalPhysicalMemory.ToString(Format("###,###,###"))
        Label13.Text = CStr(Environment.ProcessorCount)
        Dim drives() As String = Environment.GetLogicalDrives()
        Label15.Text = System.Environment.GetLogicalDrives(String.Join(", ", drives))

    End Sub

End Class

E ja agora se tiverem mais umas ideias sao bem vindas lool

abraco

Share this post


Link to post
Share on other sites
Hellblazer

tenta:

Dim strDrives As String

        For i As Integer = 0 To System.Environment.GetLogicalDrives().Length - 1

            strDrives &= System.Environment.GetLogicalDrives(i) & " ,"

        Next

        strDrives = strDrives.Remove(strDrives.Length - 1)
        Label15.Text = strDrives

E tenta dar nomes preceptiveis aos controlos :D


There are two ways to write error-free programs; only the third one works.

Share this post


Link to post
Share on other sites
cagueca

Ok obrigado . Vou experimentar quando tiver no pç . Nomes perceptiveis ao controlo ?? Como assim ??

Abraco

Share this post


Link to post
Share on other sites
Soulsick

Penso que ele se refere ao facto de teres 

Label1.Text = Environment.UserName

em vez de pores por exemplo

lblUsername.Text = Environment.UserName

:)

Share this post


Link to post
Share on other sites
Hellblazer

Penso que ele se refere ao facto de teres 

Label1.Text = Environment.UserName

em vez de pores por exemplo

lblUsername.Text = Environment.UserName

:)

Nem mais :) torna muito mais facil entender o codigo :)


There are two ways to write error-free programs; only the third one works.

Share this post


Link to post
Share on other sites
jpaulino

sim ficou

Abraco

Ok, obrigado.

É só para indicar como tal, colocando [Resolvido], para que os outros vejam que o problema está resolvido :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.