2016-03-21 33 views
-1

Kullanıcı tarafından girilen ve onu bir listeye aktaran bir dize almaya çalışıyorum. Ekle düğmesine tıkladığımda liste silinir. İşte kod. Yardımlarınız buradaListeye Öğe Ekleme

Const ModelPrompt As String = "Input Car Model" 
Const ModelTitle As String = "Car Model" 

Const PricePrompt As String = "Input Car MSRP" 
Const PriceTitle As String = "Car MSRP" 


carModel = InputBox(ModelPrompt, ModelTitle) 
carPrice = InputBox(PricePrompt, PriceTitle) 

Do While carModel <> String.Empty _ 
AndAlso carPrice <> String.Empty 

    carListBox.Items.Add(carModel) 
    msrpListBox.Items.Add(carPrice) 

Loop 
+0

ben size bütün kodunu göndermeniz gerekmektedir düşünüyorum. Liste başlatıldı nerede? –

+0

Sadece girdiyi kullanıcıdan almalı ve listeye eklemeliyim. Bu, tüm düğme için kod. – PhilDelph

+0

Bunun basit bir hata olduğunu hissediyorum, ama ne yaptığımı bilmiyorum yanlış teşekkür ederim. – PhilDelph

cevap

0

fo teşekkür ederiz kod arkadaşım

Const ModelPrompt As String = "Input Car Model" 
    Const ModelTitle As String = "Car Model" 

    Const PricePrompt As String = "Input Car MSRP" 
    Const PriceTitle As String = "Car MSRP" 

    Dim carModel As Object = InputBox(ModelPrompt, ModelTitle) 
    Dim carPrice As Object = InputBox(PricePrompt, PriceTitle) 

    If String.IsNullOrEmpty(carModel) = False And String.IsNullOrEmpty(carPrice) = False Then 
     ListBox1.Items.Add(carModel) 
     ListBox2.Items.Add(carPrice) 
    End If 
İlgili konular