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)
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 1 year ago.
Improve this question
My program wants to delete a table IF IT EXISTS. This neat little function (courtesy Terry Kreft) used to work every time, but today, under Access 365, it fails with "Item not found in this collection."
Function TableExists(Tablename As String) As Boolean
Dim loTab As DAO.TableDef
On Error Resume Next
Set loTab = CurrentDb.TableDefs(Tablename) <<<< This is where the error occurs
TableExists = (Err = 0)
End Function
`
Now in this case the table definitely DOES NOT EXIST, so the error message is correct - but surely it should not be output following the "On Error"
I would be grateful for any help!
Sorry - I am a twit!
I had VBA Tools | Options | General "Break on all errors" set. Flipped to "Break on unhandled errors" and now everything works.
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 5 years ago.
Improve this question
I have an Access DB that I want to capture the user's name when they open it. I have created a function to return the user name lifted from another Stack Overflow question:
Function UserNameWindows() As String
UserName = Environ("USERNAME")
Debug.Print UserName
End Function
This works in that I can see my user name in the immediate window. However, when I try and query this I get nothing back - no user name and no error message.
INSERT INTO tblUser(UserName,Logindate)
SELECT UserNameWindows(), Date() ;
I'm using Access 2016. The date goes into the log table but not the user's name; any idea where I'm going wrong?
You need to set the name of your function to the value of username. Your bug is a typo. See the small edit below:
Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
Debug.Print UserName
End Function
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.
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 needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
When I run this VBA code, I get an error.
Option Explicit
Sub CreateBorder()
ActiveCell.CurrentRegion.BorderAround
LineStyle:=xlDot, Weight:=xlThick, Color=RGB(255,0,0)
End Sub
The error seems to come up in the Sub CreateBorder() line. What is the problem?
There are two issues:
you can't split a statement across two lines (unless you use a _ at the end of the first line)
parameters names need to be followed by := (you use Color=...)
So it can be:
ActiveCell.CurrentRegion.BorderAround LineStyle:=xlDot, Weight:=xlThick, Color:=RGB(255, 0, 0)
or
ActiveCell.CurrentRegion.BorderAround _
LineStyle:=xlDot, Weight:=xlThick, Color:=RGB(255, 0, 0)