Click here to Skip to main content
15,867,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
ListBox1.Items.Clear()
Try
Dim wc As New Net.WebClient
wc.Encoding = System.Text.Encoding.Default
Dim wb As New System.Net.WebClient
Dim sr As String = wb.DownloadString("")
Dim regex As New Regex("")
Dim matches As MatchCollection = regex.Matches(sr)
For Each element As Match In matches
ListBox1.Items.Add(element.Value)
Next
Catch ex As Exception

End Try
End Sub

What I have tried:

How to convert this code from VB to Delphi
Posted
Updated 7-Dec-17 2:52am

1 solution

It would make no sense to convert the code because it does not work (passing empty strings for URI and regex).

If the VB.Net code would be correct, you would have to replace the VB.Net specific classes and operations with corresponding Delphi classes and functions:

  • Radio button change handler
  • A web client that downloads from an URI storing as string after converting using a specified encoding
  • Regex matching
  • Adding strings to a list box
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900