Search:

Type: Posts; User: David Anton

Page 1 of 13 1 2 3 4

Search: Search took 0.11 seconds.

  1. Replies
    9
    Views
    1,112

    Re: Simple Questions?

    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...
  2. Replies
    9
    Views
    1,112

    Re: Simple Questions?

    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...
  3. Replies
    2
    Views
    697

    VS 2022 Re: Distribution Problem

    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...
  4. Re: Set property Isvisible in a WPF form with for next loop

    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...
  5. Replies
    18
    Views
    2,341

    Re: WPF vs Winform

    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).
  6. VS 2022 Re: upgrade VB6 to Blazor WebAssembly, MVC or .NET MAUI?

    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...
  7. Replies
    4
    Views
    2,341

    VS 2022 Re: Single exe file

    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...
  8. VS 2019 Re: Newbie Converting C# to VB, Vector Problems

    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...
  9. Replies
    4
    Views
    972

    VS 2022 Re: Single exe file

    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.
  10. VS 2022 Re: Removing the last line carriage from a string

    The trimming won't be limited to the last vbCrLf - it will take off all ending whitespace, which I don't think they want.
  11. VS 2022 Re: Removing the last line carriage from a string

    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,...
  12. VS 2019 Re: (newbie question) "Use compound assignment" in a simple program

    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.
  13. Replies
    7
    Views
    1,176

    VS 2019 Re: C# convert Error

    What is 'DisplayNotification'? Why isn't this in your original C# code?
  14. Replies
    7
    Views
    1,176

    VS 2019 Re: C# convert Error

    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...
  15. Replies
    7
    Views
    1,176

    VS 2019 Re: C# convert Error

    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...
  16. Replies
    5
    Views
    1,425

    Re: Alias's

    You could simplify the If/Else with the If operator:


    Me.HouseNumberTextBoxColumn = If(FilterCheckbox, New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn, New DataGridViewcolumn)

    ...
  17. VS 2019 Re: What is the equivalent of static from VB.Net in C#

    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...
  18. Re: Identical Split() call works fine in one program but not in another

    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).
  19. Re: Identical Split() call works fine in one program but not in another

    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...
  20. Replies
    16
    Views
    2,728

    Re: Why does this not work ?

    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...
  21. Replies
    16
    Views
    2,728

    Re: Why does this not work ?

    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...
  22. Replies
    16
    Views
    2,728

    Re: Why does this not work ?

    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...
  23. Replies
    16
    Views
    2,728

    Re: Why does this not work ?

    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...
  24. Replies
    16
    Views
    2,728

    Re: Why does this not work ?

    "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...
  25. Replies
    11
    Views
    2,996

    Re: Get and set - VS2022

    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.
  26. Replies
    6
    Views
    2,766

    Re: Optimise a For loop VB.net

    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),...
  27. Replies
    7
    Views
    7,231

    VS 2019 Re: Import c# project into VB.NET Project

    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...
  28. Replies
    7
    Views
    7,231

    VS 2019 Re: Import c# project into VB.NET Project

    Your solution can have both VB and C# projects.

    (Also, why would a project be too big to convert?).
  29. Re: If Statement not yielding expected result

    Your code simplified is:

    btnEdit.Enabled = String.IsNullOrWhiteSpace(txtEffective.Text)

    Are you sure this is accurate?
  30. Replies
    8
    Views
    1,208

    VS 2010 Re: [RESOLVED] there is no end if why

    Right - I read the thread too quick!
  31. Replies
    8
    Views
    1,208

    VS 2010 Re: [RESOLVED] there is no end if why

    Why not keep in succinct?


    Return s <> 0
  32. Replies
    53
    Views
    10,253

    Re: Do you use ()'s for your IF statements?

    It's just not required in VB - so why do it?
    Also, " = True" is not required in any language.
  33. Replies
    7
    Views
    4,830

    VS 2019 Re: Do you use Decimal, single, or double?

    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...
  34. Re: [RESOLVED] What is a short function name for Convert.ToDecimal

    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...
  35. VS 2019 Re: Return value is not necessary in MsgBox? How?

    It's not just MsgBox - you can call *any* function and ignore the return value.
  36. Replies
    6
    Views
    1,473

    Re: Converting C3 to VB.Net

    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...
  37. Replies
    12
    Views
    1,996

    Re: Factorial

    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...
  38. Re: Class library project not the same as windows form project for string functions

    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...
  39. Re: Class library project not the same as windows form project for string functions

    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...
  40. Replies
    39
    Views
    4,476

    Re: Learning C# from VB

    Actually, in C# you can just write "a == b" instead.

    Agree with you about math: there are subtle issues converting either way.
Results 1 to 40 of 500
Page 1 of 13 1 2 3 4



Click Here to Expand Forum to Full Width