dbasnett's Profile User Rating: -----

Reputation: 109 Stalwart
Group:
Contributors
Active Posts:
604 (0.27 per day)
Joined:
01-October 08
Profile Views:
7,515
Last Active:
User is offline Yesterday, 05:52 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
50

Latest Visitors

Icon   dbasnett has not set their status

Posts I've Made

  1. In Topic: Help with BCD Addition (please)

    Posted 11 Oct 2014

    Here is a method that converts a BCD string to a number.

        Private Function ConvertBCDStringToNum(bcdstr As String) As Long
            'clean up input string
            Dim s As String = bcdstr.Replace(" ", "") 'get rid of spaces in input
            Do While s.Length Mod 4 <> 0  'forces multiple of 4 chars?
                'no
                s = s.Insert(0, "0")
            Loop
    
            Dim digits As New List(Of Integer)
    
            'work with groups of four chars
            For idx As Integer = 0 To s.Length - 4 Step 4
                Dim adigit As Integer
                Try
                    'convert group of 4 to integer
                    adigit = Convert.ToInt32(s.Substring(idx, 4), 2)
                Catch ex As Exception
                    Throw 'not binary
                End Try
                'legal bcd
                If adigit < 0 OrElse adigit > 9 Then
                    Throw New Exception("Not BCD")
                End If
                digits.Add(adigit) 'remember digit
            Next
            digits.Reverse() 'work from units upward
            Dim rv As Long = 0L 'the return value
            Dim mult As Long = 1L
            For idx As Integer = 0 To digits.Count - 1
                Try
                    rv += digits(idx) * mult 'sum the digits
                    If idx <> digits.Count - 1 Then mult *= 10L 'adjust multiplier
                Catch ex As Exception
                    Throw 'the number will not fit in a long
                End Try
            Next
            Return rv
        End Function
    
    


    See if it helps and step through it for a better understanding of what it does.
  2. In Topic: Need help, trying to display integer value in textbox

    Posted 5 Aug 2014

    They way the code is now, with CoolingLoadBTU making many appearances, is very confusing. Start by deleting lines 11, and 23-33. Un-comment line 3. The Then on your If's should be changed to simple assignments , like, Then CoolingLoadBTU = 36.

    See if that helps.
  3. In Topic: ComboBox, different behavior on Windows 7 and 8.1

    Posted 25 Jul 2014

    View PostIronRazer, on 25 July 2014 - 05:17 AM, said:

    Yes, i noticed that yesterday in your example code. I never used it until then. I`ll have to check it out further to see what the difference is in when the event gets raised (for my own knowledge). Like i said, i didn`t play with it very long.


    The event fires only when the user is manipulating the control. It does not fire if the program changes the index programmatically. Don't know what version of .Net it was introduced in.
  4. In Topic: ComboBox, different behavior on Windows 7 and 8.1

    Posted 25 Jul 2014

    View PostIronRazer, on 25 July 2014 - 05:06 AM, said:

    Hey DB,
    I see you did. Nice workaround. I will try it out later. B)/>/>/>/>/>/>


    Hopefully it works on XP. BTW - did you notice that the event is .SelectionchangeCommitted and not .SelectedIndexChanged?

    edit: Why is the editor changing Change to change in .SelectionchangeCommitted ?
  5. In Topic: ComboBox, different behavior on Windows 7 and 8.1

    Posted 25 Jul 2014

    I did find a workaround.
        Private Sub ComboBox1_SelectionchangeCommitted(sender As Object, e As EventArgs) Handles ComboBox1.SelectionchangeCommitted
            Debug.WriteLine("CB1Committed Index: [{0}] Text: [{1}]",
                              ComboBox1.SelectedIndex,
                              ComboBox1.Text)
            Dim foo As Integer = ComboBox1.SelectedIndex '<<<<<fix
            ComboBox2.Select()
            ComboBox1.SelectedIndex = foo '<<<<fix
        End Sub
    
    

My Information

Member Title:
D.I.C Addict
Age:
Age Unknown
Birthday:
July 29
Gender:
Years Programming:
45

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Friends

Comments

dbasnett has no profile comments yet. Why not say hello?