VBrazil
Nov 25th, 1999, 08:33 AM
I got a really weird problem while using ini's, and there it is: In a form to get prices and calculate them, i added this line to make the total price appear in this manner: Amount X unit price = total price
Line of code:
lstTotal.AddItem (txtQuantidade.Text & " X " & Trim(Temp) & " = " & txtQuantidade * Trim(Temp))
Here is the complete command code
Dim ret As Long
Dim Temp As String * 50
Dim lpAppName As String, lpKeyName As String, lpDefault As String, lpFileName As String
lpAppName = "Precos"
lpKeyName = txtNome.Text
lpDefault = "c:\Util\Lojas\preview.ini"
lpFileName = "c:\Util\Lojas\preview.ini"
ret = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, Temp, Len(Temp), lpFileName)
If ret = 0 Then
Beep
ElseIf txtQuantidade = "1" Then
lstUnitario.AddItem Trim(Temp)
lstTotal.AddItem ("1 X " & Trim(Temp))
lstProduto.AddItem txtNome.Text
lstQuantidade.AddItem txtQuantidade.Text
Text1.Text = Text1.Text + Trim(Temp)
ElseIf txtQuantidade = "0" Then
MsgBox "Quantidade é igual a 0!!", vbOKOnly, "Erro de Compreensão"
Else
lstUnitario.AddItem Trim(Temp)
lstTotal.AddItem (txtQuantidade.Text & " X " & Trim(Temp) & " = " & txtQuantidade * Trim(Temp))
lstProduto.AddItem txtNome.Text
lstQuantidade.AddItem txtQuantidade.Text
Text1.Text = Text1.Text + (txtQuantidade * Trim(Temp))
End If
Last question: If the Key name I specified to the INI doesn't exists, how could I get to the project say that it not exist? It get a weird bug, saying that the price is the path to the ini.
Very,Very Thanks
------------------
--Alex
Line of code:
lstTotal.AddItem (txtQuantidade.Text & " X " & Trim(Temp) & " = " & txtQuantidade * Trim(Temp))
Here is the complete command code
Dim ret As Long
Dim Temp As String * 50
Dim lpAppName As String, lpKeyName As String, lpDefault As String, lpFileName As String
lpAppName = "Precos"
lpKeyName = txtNome.Text
lpDefault = "c:\Util\Lojas\preview.ini"
lpFileName = "c:\Util\Lojas\preview.ini"
ret = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, Temp, Len(Temp), lpFileName)
If ret = 0 Then
Beep
ElseIf txtQuantidade = "1" Then
lstUnitario.AddItem Trim(Temp)
lstTotal.AddItem ("1 X " & Trim(Temp))
lstProduto.AddItem txtNome.Text
lstQuantidade.AddItem txtQuantidade.Text
Text1.Text = Text1.Text + Trim(Temp)
ElseIf txtQuantidade = "0" Then
MsgBox "Quantidade é igual a 0!!", vbOKOnly, "Erro de Compreensão"
Else
lstUnitario.AddItem Trim(Temp)
lstTotal.AddItem (txtQuantidade.Text & " X " & Trim(Temp) & " = " & txtQuantidade * Trim(Temp))
lstProduto.AddItem txtNome.Text
lstQuantidade.AddItem txtQuantidade.Text
Text1.Text = Text1.Text + (txtQuantidade * Trim(Temp))
End If
Last question: If the Key name I specified to the INI doesn't exists, how could I get to the project say that it not exist? It get a weird bug, saying that the price is the path to the ini.
Very,Very Thanks
------------------
--Alex