Search:
Type: Posts; User: David Anton
Search:
Search took 0.16 seconds.
-
I'm not questioning the value of Environment.NewLine, but sometimes you really want CRLF (e.g., same cases where you would use "\r\n" in other languages).
If you want CRLF then you have to use...
-
I have a different perspective on the 'vb' constants. If you look at the Microsoft documentation, you'll see that the ControlChars class constants are defined in terms of the 'vb' Constants class...
-
Did you recently upgrade to use .NET 6 or 7?
The .NET libraries in the .NET Framework are included with Windows, while .NET Core is not included with Windows.
You can have a "framework-dependent...
-
Option Infer On
' Assuming you have a container named "myContainer" that holds the text boxes
For Each control In myContainer.Children
If TypeOf control Is TextBox Then
Dim textBox As...
-
The main problem with WinUI3 is that Microsoft is seriously dragging their feet at getting this ready. Is there even a working designer available yet? (Not last I checked).
-
As with all new stuff coming from Microsoft, wait a couple of years.
Microsoft has a reputation of throwing crap at the wall to see what sticks. Also, it's obviously not complete yet - the WinUI 3...
-
Be aware that it's not really a single file - your code + the .NET code will be in a a single dll, the launcher for this will be an exe, and a few support dlls will be included.
So you're actually...
-
I think at least some of your problems are due to not using "Option Infer On". To get implicit typing in VB, you need this - otherwise the untyped variables are of type 'Object'.
Also it's hard to...
-
It's great, but the install size is truly huge. To make it worse .NET 6 has disabled trimming for WPF and WinForms, so the install size is impractical.
-
The trimming won't be limited to the last vbCrLf - it will take off all ending whitespace, which I don't think they want.
-
You can't convert vbCrLf to a character since it is 2 characters long.
Maybe you can just use something like this:
If myString.EndsWith(vbCrLf) Then
myString = myString.Substring(0,...
-
It both compiles and runs for me.
The issue about compound assignment is just a suggestion by Visual Studio - you can rewrite that statement as "n /= 2", but your version is still correct.
-
What is 'DisplayNotification'? Why isn't this in your original C# code?
-
I don't know what sort of code you posted - why are there methods directly in a namespace?
Also, similar to the code in my answer, you should use parentheses:
Call (New...
-
To call a method directly off a 'New' expression, you need to use 'Call':
Public Shared Sub Show(ByVal message As String, ByVal type As AlertType)
Call (New...
-
You could simplify the If/Else with the If operator:
Me.HouseNumberTextBoxColumn = If(FilterCheckbox, New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn, New DataGridViewcolumn)
...
-
It's not clear which way you're converting from your question, but if you mean what is the equivalent of VB 'Static' local variables in C#, then there is no equivalent - you have to declare fields...
-
They are trying to call the Microsoft.VisualBasic.Strings method, which only requires one parameter (the delimiter is assumed to be a space if omitted).
-
If you want to call the VB Microsoft.VisualBasic.Strings.Split method, then get rid of the "Imports System.String".
You are confusing the compiler - with that Imports, VB thinks you are calling the...
-
I wouldn't recommend writing code using 'Or' or 'And' as logical operators, but if they are used in order to ensure both operands are evaluated then you must have a situation where there's more going...
-
Depends if the operands of the operators are method calls - if the method calls have side-effects other than calculating the boolean return value, then it may be necessary:
e.g.,
If...
-
That's me - been doing this for a long time. I really didn't know what I was getting into when I started. I've seen code samples that would sear your eyeballs - they were so weird (not just VB, but...
-
Hard to believe, but it works with Option Strict On. I've been involved in conversion between VB and other languages for close to 20 years now and this is the first I've seen this.
VB is full of...
-
"txt > Nothing" is very, very odd and confusing - really you should be doing "Is Nothing" or "IsNot Nothing".
I know VB accepts it, but VB accepts a lot of very strange unexpected stuff.
The...
-
A 'shorthand' or 'auto' property:
Public Property Title() As Label
Also, a hidden field named "_Title" is created by the compiler. It can be used in your code elsewhere if you wish.
-
The following statement can be a performance drag if you have numerous iterations:
If UCase(MyArra1(s, 1)) = UCase(MyArra2(f, 1)) Then
It's much faster using:
If string.Equals(MyArra1(s, 1),...
-
I think you should be able to refer to the form like any other form, whether it's in the VB project or C# project. I don't do this myself, so maybe I'm missing something, but I don't see why it...
-
Your solution can have both VB and C# projects.
(Also, why would a project be too big to convert?).
-
Your code simplified is:
btnEdit.Enabled = String.IsNullOrWhiteSpace(txtEffective.Text)
Are you sure this is accurate?
-
Right - I read the thread too quick!
-
Why not keep in succinct?
Return s <> 0
-
It's just not required in VB - so why do it?
Also, " = True" is not required in any language.
-
Accuracy vs performance:
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/data-types/numeric-data-types
"The Double data type is faster and requires less...
-
You should also be aware that you're talking about two very different things here: CDec (and CInt, CBool, etc. and CType) are actually VB casts - these are part of the Visual Basic language and are...
-
It's not just MsgBox - you can call *any* function and ignore the return value.
-
Drop the 'Private' on your Main method and add 'Option Infer On' at the top of the file (to allow the inferred For loop variables).
Also, try to provide more clues to people trying to help - I'm...
-
Factorials are usually calculated using recursion in tutorials teaching recursion, but they are a classic example of when *not* to use recursion. With any real-life situation you will blow the stack...
-
Absolutely right - I was just addressing the desire to avoid VB-isms. If you want clear code, *all* VB-isms should be avoided. The ridiculous things that VB allows, like omitting empty argument lists...
-
As long as we're talking about being 'proper', you shouldn't hide the fact that these are methods, not fields (even though VB allows it):
theNumber.ToString().Trim()
i.e., leaving off empty...
-
Actually, in C# you can just write "a == b" instead.
Agree with you about math: there are subtle issues converting either way.
|
Click Here to Expand Forum to Full Width
|