This is new territory for me, VB and visual studio 2010.. I just need to make one change to a piece of code to improve functionality.
If UCase(dvPlaceDisplayList.Item(i)("PlaceName")) >= UCase(ToolStripTxtFind.Text) Then
The issue I am having is that several place names are prefixed with 'The' ..
I need to change the code to Contains or similar using wildcards
As VB is new to me and googling has not provided any answers...here I am
Thanks
The solution is to use:
If UCase(dvPlaceDisplayList.Item(i)("PlaceName")) LIKE "*" & UCase(ToolStripTxtFind.Text) & "*" Then
Related
I have some visual basic code where i have a for loop and for company syntax reason, we need to include a _ at the en of the from in line. However, whenever I unfocus from the code, the " _ " gets deleted
I tried messing around in the option under Tools > Options > Text Editor > Basic > advance and unchecking everything but that did not help.
this is the code i want to produce:
Dim burger = (From p In db.PreviousDeclarations _
Where p.burgerID = CompanyID.Value And Object.Equals(p.Year, Year)
This is the code visual studio keep "Correcting" for me:
Dim burger = (From p In db.PreviousDeclarations
Where p.burgerID = CompanyID.Value And Object.Equals(p.Year, Year)
Uncheck Pretty listing (reformatting) of code, located in Options->Text Editor->Basic-> Advanced->Editor Help
Recent versions of Visual Studio will delete the line continuation characters when they're not necessary, typically when the first line alone would not compile on its own but the line below makes it syntactically valid. I know from experience that it's annoying when switching to a new VS that does this, as a small change can easily look like a huge refactoring when doing a diff.
I don't believe there's any way to disable the functionality. If you need them for a company style guideline I suggest you update the guidelines
I am trying to add the path and file name of files that throw exceptions (see image attached). My code works but Visual Studio Community Edition 2015 (VB.NET 4.6) reports "Variable 'FileName' is used before it is assigned a value...". Can anyone suggest how I can remove this issue, or whether this is ok to ignore? I am new to VB.NET and would be happy to reformat my code if there is a better way to do this.
Regards
George
use this:
Dim FileName as String = Nothing 'String.Empty 'C#: null
I've been trying to find a way to render \r\n as actual newlines in the immediate and command window in my VB.NET 4.5.1 application. I came across this question which teaches about the nq specifier, but it appears to apply only to C#. In VB.NET, nq doesn't even appear to work because I get Expression expected printed back out at me.
Is there a different way to make newlines actually show as separate lines in the immediate or command window in VB.NET?
An easier way in visual studio 2015 is to do this in the debug window:
?string,nq
You can also do the debug version in earlier versions of VS
?System.Diagnostics.Debug.Print(string,nq)
I've discovered that the solution is to use System.Diagnostics.Debug.Print(). To reproduce the original issue, entering this into the Immediate window...
? "a" & vbCrLf & "a"
...just returns this:
"a a"
However, using this...
System.Diagnostics.Debug.Print("a" & vbCrLf & "a")
...actually shows the newline:
a
a
I am trying to code some Excel automation stuff using VB in VS2013. Basically, I can perform a lot of excel operation from my code (even applying the data analysis tool, and creating histograms).
However, in my case, Visual Studio is complaining 'xlQualityStandard' is not declared.
Here is a sample of my code
Imports Microsoft.Office
Imports Excel = Microsoft.Office.Interop.Excel
' do something
xlTempSheet.ExportAsFixedFormat(Type:=Excel.XlFixedFormatType.xlTypePDF, Filename:="c:\plots test\test.pdf",
IgnorePrintAreas:=True, OpenAfterPublish:=True, Quality:=xlQualityStandard)
If I remove
Quality:=xlQualityStandard
The code will just work.
In my case,
Excel.XlFixedFormatQuality.xlQualityStandard
will work. Thanks to user2930100
The values can be found here
https://msdn.microsoft.com/en-us/library/bb241292(v=office.12).aspx
xlQualityMinimum 1 Minimum quality
xlQualityStandard 0 Standard quality
Interestingly Google now seems to provide API help
I'm using visual studio 2010 to create a report, the data is being used from a SQL database
One particular set of data is being returned as integers instead of text, therefore I want to be able to do a statement where if the integer is 1 then set it as "Random" if 2 then set it as "Question" for example
I've tried the following but been unsuccessful
=Replace(Fields!new_IssueType.Value,"1","Issue")
=Replace(Fields!new_IssueType.Value,"2","Complaint")
=Replace(Fields!new_IssueType.Value,"3","FM Complaint")
=Replace(Fields!new_IssueType.Value,"4","Rejected")
I'm new to creating these expressions so I apologise if this question is a simple fix.
Try using this code:
=IIF(Fields!new_IssueType.Value = "1","Issue",IIF(Fields!new_IssueType.Value = "2","Complaint",IIF(Fields!new_IssueType.Value="3","FM Complaint",IIF(Fields!new_IssueType.Value="4","Rejected",""))))