Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I am trying to find which value is assigned to strA?
Dim dbleTest as Double = 0.25
Dim strA as String = dblTest.ToString("p")
If you correct your typo, and use Dim dlbTest As Double = 0.25, then this prints 25.00 % (locale specific, some locales may have different decimal separators).
Without that in place, the result will depend on the Option Explicit checking currently in place in the file, and potentially the value assigned to dblTest (if it exists in scope).
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
' Load data for the ViewModel Items
Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs)
Using (StudentContext c = New StudentContext(StudentContext.ConnectionString))
c.CreateIfNotExists()
c.LogDebug = True
MainLongListSelector.ItemsSource = c.Students.ToList()
End Using
End Sub
I have error ')' expects and in line 3 on "c". How to handle this? Thanks
You're using C# syntax in VB .NET.
Try
Using c as StudentContext = New StudentContext(StudentContext.ConnectionString)
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Alright, I've managed to get a string containing HTML content inside of it, but I need to get into an HTMLDocument for parsing.
I've tested the following code, and I've been unable to get it to work through any of the variations I've tried.
Dim webclient As New System.Net.WebClient
Dim result As String = webclient.DownloadString(link)
Dim htm As HtmlDocument
htm = htm.Write(result)
Dim sDD As Object
sDD = htm.GetElementById("tag-sidebar")
Dim IDD As Object
IDD = htm.GetElementById("highres")
Currently it is telling me that htm = htm.Write(result) does not produce a value, so I'm sort of stumped.
I'm Currently using Microsoft Visual Studio 2013 Professional
The error just indicates that the Write method does not produce a value. In VB-speak that means Write is a Sub, not a Function.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Example: consider there are 5 names separated with a semicolon. I want to separate these 5 names.
consider,
Richard;Pareek;Elizabeth;Creig;Tomy
You would use the Split() function.
Example:
Dim input as String
Dim results() as String
input = "Richard;Pareek;Elizabeth;Creig;Tomy"
results = Split(input,";")
Note: If there are are spaces after the semicolons, be sure to include that in the second parameter of the Split function (so "; " instead of ";")
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i am new to VB.
I am trying to retrieve the last value in the csv below.
0066,0055,0078
From this string, I want to fetch 0078.
From this string, I want to fetch 0078.
Try this,
Dim xString as String = "0066,0055,0078"
Dim xResult() as String = xString.split(",")
Dim xExtracted as String = xResult(xResult.length-1)
MsgBox(xExtracted)
a shorter alternative would be:
Dim xString as String = "0066,0055,0078"
MsgBox(xString.Substring(xString.LastIndexOf(",") + 1))
if you are going to use the function regularly consider creating an extension method
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I have a large text file with over 100k of lines. Some of the lines are duplicates. I would like to be a to dedupe these entries before processing them. I am using visual basic 2010 Express to write this.
Text file example:
132165
165461
646843
654654
321358
132165
165461
I want to dedupe these entries before processing them
You can use a HashSet(Of T)
Dim nodupes As New HashSet(Of String)(File.ReadLines(path))
For Each str As String In nodupes
' no duplicate here '
Next
Edit Since a HashSet(Of T) does not guarantee to preserve the insertion order you can use following code if you need to ensure this order:
Dim nodupeSet As New HashSet(Of String)
Dim nodupes = From line In File.ReadLines(path)
Where nodupeSet.Add(line)
For Each str As String In nodupes
' no duplicate here '
Next