Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help adding a conditional statement

Status
Not open for further replies.

pbanacos

IS-IT--Management
Apr 21, 2006
34
US
Hello,

I have a CheckedListBox that will list common RIA applications. I want to check if the object assigned to 'itemchecked' is equal to java and if so to download it. Please see below:

Dim itemChecked As Object

For Each itemChecked In CheckedListBox1.CheckedItems
If itemChecked.ToString = "java" Then
Dim myWebClient As New Net.WebClient()
myWebClient.DownloadFile(" "C:\jre_6u29.32.exe")
End If
Next

Any help would be greatly appreciated!

PB
 

What is your question?


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
When I try using the if statement below it doesn't work and nothing is checked... im not sure why?

If itemChecked.ToString = "java" Then

Thanks Again,

Paul
 
Try throwing this in the For loop to see what's being returned:


Dim itemChecked As Object

For Each itemChecked In CheckedListBox1.CheckedItems

[red]MsgBox("*" & itemChecked.ToString & "*")[/red]

If itemChecked.ToString = "java" Then
Dim myWebClient As New Net.WebClient()
myWebClient.DownloadFile(" "C:\jre_6u29.32.exe")
End If
Next

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top