From: GS on
Thanks! I just use the Immediate Window (mostly) to test individual
procs.

I appreciate your interest!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


From: Henning on

"GS" <gesansom(a)netscape.net> skrev i meddelandet
news:htrf7b$quq$1(a)news.eternal-september.org...
> Henning formulated on Saturday :
>> "GS" <gesansom(a)netscape.net> skrev i meddelandet
>> news:htpsbg$qk$1(a)news.eternal-september.org...
>>> on 5/28/2010, Henning supposed :
>>>> "Derek" <derekrss(a)yahoo.ca> skrev i meddelandet
>>>> news:527036a6-1c91-40a9-8f89-673eb78cd857(a)q13g2000vbm.googlegroups.com...
>>>> On May 28, 4:13 pm, GS <gesan...(a)netscape.net> wrote:
>>>>> I'm thinking that I should retain the delimited values and dump it
>>>>> into
>>>>> an array using Split(). This would, at least, preserve the individual
>>>>> values return by the Hex2Dec function. Problem is, as you say, how to
>>>>> determine what the original string was from the resulting string. For
>>>>> example, returning Hex(14) returns "E" and not "0E".
>>>>>
>>>>> Any suggestions you have would be greatly appreciated.
>>>>>
>>>>
>>>> Returning RIGHT$(HEX$(256 + 14), 2) would return "0E"
>>>>
>>>> Cheers
>>>>
>>>> Derek
>>>>
>>>> ----
>>>> And so will Right$("0" & Hex$(14),2)
>>>>
>>>> /Henning
>>>
>>> True for this pair of hex digits. Not going to work for all pairs as
>>> does using '256'. Results using "0" instead of '256':
>>>
>>> Original hexString: "0E0E00000505000C20450164A5A5"
>>> Returns DecString: "14,14,0,0,5,5,0,12,32,69,1,100,165,165"
>>> Restore DecString returns: "EE00550C2045164A5A5", which is not what we
>>> want.
>>>
>>> regards,
>>>
>>> -- Garry
>>>
>>> Free usenet access at http://www.eternal-september.org
>>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>>
>>>
>>
>> Yes it *is* the same thing.
>>
>> On a Form add a Commandbutton and a TextBox
>>
>> Option Explicit
>>
>>
>>
>> Private Sub Command1_Click()
>> Dim i As Long
>>
>> Dim s1 As String
>> Dim s2() As String
>>
>> s1 = "14,14,0,0,5,5,0,12,32,69,1,100,165,165"
>> s2 = Split(s1, ",")
>> Text1.Text = ""
>>
>> For i = 0 To UBound(s2)
>> Text1.Text = Text1.Text & Right$("0" & Hex$(Val(s2(i))), 2)
>> Next
>> End Sub
>>
>> The ouput in Text1.Text is "0E0E00000505000C20450164A5A5"
>>
>> /Henning
>
> Thanks for persisting! - What you post today is not what you posted
> yesterday.
>
> Today's post Works!
> For i = LBound(v) To UBound(v)
> Dec2Hex = Dec2Hex & Right$("0" & Hex$(Val(s2(i))), 2)
> Next
>
> Yesterday's did not work (as substituting "0" for '256' was implied)!
> For i = LBound(v) To UBound(v)
> Dec2Hex = Dec2Hex & Right(Hex("0" + CLng(v(i))), 2)
> Next
>
> Try what you posted yesterday in my code samples to see for yourself!
> This works: Right(Hex(256 + CLng(v(i))), 2)
> This does not: Right(Hex("0" + CLng(v(i))), 2)
>
> I'm just working with Hex/Dec for the first time, and so I'm relying on
> you folks for guidance. I feel I do a pretty thorough job of testing my
> stuff before using it (most times, anyway). That process also includes
> testing offerings from others in context to my usage needs. Up to now,
> I've relied on Excel's Hex2Dec and Dec2Hex functions to do all the
> 'behind-the-scenes' stuff. Please know I appreciate your efforts AND
> patience. It has made me a better VB6 programmer than I was before this
> got started.<bg!> Props to all who have contributed...
>
> regards,
>
> --
> Garry
>
> Free usenet access at http://www.eternal-september.org
> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>
You are mixing it up.
This is *not* what I posted : Right(Hex("0" + CLng(v(i))), 2)
This is *what* I posted : Right$("0" & Hex$(14),2)

See the difference?

/Henning


From: Henning on

"GS" <gesansom(a)netscape.net> skrev i meddelandet
news:htrgmr$bg$1(a)news.eternal-september.org...
>> Hint:
>> ASCII &H30 = "0" , ASCII &H45 = "E" in the ASCII table.
>>
>> /Henning
>
> Thanks again! I now understand what my user is trying to do. Here's the
> scenario:
> 1. User has automated equipment that uses NC code to operate.
> 2. Manufacturer of said equip. loads progs as per user needs.
> 3. My user wants to load their own progs.
>
> How it works:
> 1. The equipment is operated from a control panel.
> Input is via keys on the Control Panel.
> Keystrokes are converted to HexDigits.
> PostProcessor compiles user input to NC MachineCode.
>
> 2. The equipment executes the NC MachineCode.
>
> So this is essentially a 2-stage process. The equip. can store NC progs to
> be recalled as needed. What my user wants to do is program from a PC and
> pass the string of HexDigits to the control panel via its RS232 port, thus
> eliminate having to stand in front of the control panel. An additional
> benefit is having more storage capacity on their PC than what's built into
> the equipment controller. They could then just download whatever progs
> they need to use at runtime.
>
> Thanks to your hint here, I now understand what my user was showing me by
> the compiled output of the PostProcessor. I suspect the underlying
> methodology of the operating scheme works similar to property=value pairs.
> So you just informed me of how to create the expected NC MachineCode. The
> sample I was provided for HexDigit 0E is the Ascii value '3045'. That
> tells me the equipment is parsing in pairs, and so is why it uses
> HexDigits for user input, and Ascii (machine code) for runtime execution.
>
> This means I can get busy with adding a feature that generates the
> expected MachineCode so my user can verify this at the control panel as a
> QC step.
>
> Input is always appreciate...
>
> --
> Garry
>
> Free usenet access at http://www.eternal-september.org
> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>
>

Something like this?

Option Explicit

Private Sub Command1_Click()
Dim i As Long
Dim s0 As String
Dim s1 As String

s0 = "0E0E00000505000C20450164A5A5"
Text1.Text = ""
s1 = ""
For i = 1 To Len(s0)
s1 = s1 & Hex$(Asc(Mid$(s0, i, 1)))
Next
Text1.Text = s1
End Sub

Text1 = "30453045303030303035303530303043323034353031363441354135"

/Henning


From: GS on
It happens that Henning formulated :
> "GS" <gesansom(a)netscape.net> skrev i meddelandet
> news:htrf7b$quq$1(a)news.eternal-september.org...
>> Henning formulated on Saturday :
>>> "GS" <gesansom(a)netscape.net> skrev i meddelandet
>>> news:htpsbg$qk$1(a)news.eternal-september.org...
>>>> on 5/28/2010, Henning supposed :
>>>>> "Derek" <derekrss(a)yahoo.ca> skrev i meddelandet
>>>>> news:527036a6-1c91-40a9-8f89-673eb78cd857(a)q13g2000vbm.googlegroups.com...
>>>>> On May 28, 4:13 pm, GS <gesan...(a)netscape.net> wrote:
>>>>>> I'm thinking that I should retain the delimited values and dump it into
>>>>>> an array using Split(). This would, at least, preserve the individual
>>>>>> values return by the Hex2Dec function. Problem is, as you say, how to
>>>>>> determine what the original string was from the resulting string. For
>>>>>> example, returning Hex(14) returns "E" and not "0E".
>>>>>>
>>>>>> Any suggestions you have would be greatly appreciated.
>>>>>>
>>>>>
>>>>> Returning RIGHT$(HEX$(256 + 14), 2) would return "0E"
>>>>>
>>>>> Cheers
>>>>>
>>>>> Derek
>>>>>
>>>>> ----
>>>>> And so will Right$("0" & Hex$(14),2)
>>>>>
>>>>> /Henning
>>>>
>>>> True for this pair of hex digits. Not going to work for all pairs as does
>>>> using '256'. Results using "0" instead of '256':
>>>>
>>>> Original hexString: "0E0E00000505000C20450164A5A5"
>>>> Returns DecString: "14,14,0,0,5,5,0,12,32,69,1,100,165,165"
>>>> Restore DecString returns: "EE00550C2045164A5A5", which is not what we
>>>> want.
>>>>
>>>> regards,
>>>>
>>>> -- Garry
>>>>
>>>> Free usenet access at http://www.eternal-september.org
>>>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>>>
>>>>
>>>
>>> Yes it *is* the same thing.
>>>
>>> On a Form add a Commandbutton and a TextBox
>>>
>>> Option Explicit
>>>
>>>
>>>
>>> Private Sub Command1_Click()
>>> Dim i As Long
>>>
>>> Dim s1 As String
>>> Dim s2() As String
>>>
>>> s1 = "14,14,0,0,5,5,0,12,32,69,1,100,165,165"
>>> s2 = Split(s1, ",")
>>> Text1.Text = ""
>>>
>>> For i = 0 To UBound(s2)
>>> Text1.Text = Text1.Text & Right$("0" & Hex$(Val(s2(i))), 2)
>>> Next
>>> End Sub
>>>
>>> The ouput in Text1.Text is "0E0E00000505000C20450164A5A5"
>>>
>>> /Henning
>>
>> Thanks for persisting! - What you post today is not what you posted
>> yesterday.
>>
>> Today's post Works!
>> For i = LBound(v) To UBound(v)
>> Dec2Hex = Dec2Hex & Right$("0" & Hex$(Val(s2(i))), 2)
>> Next
>>
>> Yesterday's did not work (as substituting "0" for '256' was implied)!
>> For i = LBound(v) To UBound(v)
>> Dec2Hex = Dec2Hex & Right(Hex("0" + CLng(v(i))), 2)
>> Next
>>
>> Try what you posted yesterday in my code samples to see for yourself!
>> This works: Right(Hex(256 + CLng(v(i))), 2)
>> This does not: Right(Hex("0" + CLng(v(i))), 2)
>>
>> I'm just working with Hex/Dec for the first time, and so I'm relying on you
>> folks for guidance. I feel I do a pretty thorough job of testing my stuff
>> before using it (most times, anyway). That process also includes testing
>> offerings from others in context to my usage needs. Up to now, I've relied
>> on Excel's Hex2Dec and Dec2Hex functions to do all the 'behind-the-scenes'
>> stuff. Please know I appreciate your efforts AND patience. It has made me a
>> better VB6 programmer than I was before this got started.<bg!> Props to all
>> who have contributed...
>>
>> regards,
>>
>> -- Garry
>>
>> Free usenet access at http://www.eternal-september.org
>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>
> You are mixing it up.
> This is *not* what I posted : Right(Hex("0" + CLng(v(i))), 2)
> This is *what* I posted : Right$("0" & Hex$(14),2)
>
> See the difference?
>
> /Henning

Yes, I see the difference! It's not the syntax I was referring to; it
was the concept of substituting "0" for '256' in MY CODE. Sorry for any
misunderstanding here, but I am NOT mistaken since I acknowledged
yesterday that your code (as posted) worked for that particular
HexDigit, but when I substituted "0" in MY CODE (as you implied) it did
not work. That could very well be because of my lack of knowledge in
this area, and so in no way was I inferring your code was bad. -I just
didn't know enough at that point about what I was into.

Again, I thank you for your persistence and patience with trying to
help me. -Much appreciated!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


From: Henning on

"GS" <gesansom(a)netscape.net> skrev i meddelandet
news:htrn1j$pae$1(a)news.eternal-september.org...
> It happens that Henning formulated :
>> "GS" <gesansom(a)netscape.net> skrev i meddelandet
>> news:htrf7b$quq$1(a)news.eternal-september.org...
>>> Henning formulated on Saturday :
>>>> "GS" <gesansom(a)netscape.net> skrev i meddelandet
>>>> news:htpsbg$qk$1(a)news.eternal-september.org...
>>>>> on 5/28/2010, Henning supposed :
>>>>>> "Derek" <derekrss(a)yahoo.ca> skrev i meddelandet
>>>>>> news:527036a6-1c91-40a9-8f89-673eb78cd857(a)q13g2000vbm.googlegroups.com...
>>>>>> On May 28, 4:13 pm, GS <gesan...(a)netscape.net> wrote:
>>>>>>> I'm thinking that I should retain the delimited values and dump it
>>>>>>> into
>>>>>>> an array using Split(). This would, at least, preserve the
>>>>>>> individual
>>>>>>> values return by the Hex2Dec function. Problem is, as you say, how
>>>>>>> to
>>>>>>> determine what the original string was from the resulting string.
>>>>>>> For
>>>>>>> example, returning Hex(14) returns "E" and not "0E".
>>>>>>>
>>>>>>> Any suggestions you have would be greatly appreciated.
>>>>>>>
>>>>>>
>>>>>> Returning RIGHT$(HEX$(256 + 14), 2) would return "0E"
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> Derek
>>>>>>
>>>>>> ----
>>>>>> And so will Right$("0" & Hex$(14),2)
>>>>>>
>>>>>> /Henning
>>>>>
>>>>> True for this pair of hex digits. Not going to work for all pairs as
>>>>> does using '256'. Results using "0" instead of '256':
>>>>>
>>>>> Original hexString: "0E0E00000505000C20450164A5A5"
>>>>> Returns DecString: "14,14,0,0,5,5,0,12,32,69,1,100,165,165"
>>>>> Restore DecString returns: "EE00550C2045164A5A5", which is not what we
>>>>> want.
>>>>>
>>>>> regards,
>>>>>
>>>>> -- Garry
>>>>>
>>>>> Free usenet access at http://www.eternal-september.org
>>>>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>>>>
>>>>>
>>>>
>>>> Yes it *is* the same thing.
>>>>
>>>> On a Form add a Commandbutton and a TextBox
>>>>
>>>> Option Explicit
>>>>
>>>>
>>>>
>>>> Private Sub Command1_Click()
>>>> Dim i As Long
>>>>
>>>> Dim s1 As String
>>>> Dim s2() As String
>>>>
>>>> s1 = "14,14,0,0,5,5,0,12,32,69,1,100,165,165"
>>>> s2 = Split(s1, ",")
>>>> Text1.Text = ""
>>>>
>>>> For i = 0 To UBound(s2)
>>>> Text1.Text = Text1.Text & Right$("0" & Hex$(Val(s2(i))), 2)
>>>> Next
>>>> End Sub
>>>>
>>>> The ouput in Text1.Text is "0E0E00000505000C20450164A5A5"
>>>>
>>>> /Henning
>>>
>>> Thanks for persisting! - What you post today is not what you posted
>>> yesterday.
>>>
>>> Today's post Works!
>>> For i = LBound(v) To UBound(v)
>>> Dec2Hex = Dec2Hex & Right$("0" & Hex$(Val(s2(i))), 2)
>>> Next
>>>
>>> Yesterday's did not work (as substituting "0" for '256' was implied)!
>>> For i = LBound(v) To UBound(v)
>>> Dec2Hex = Dec2Hex & Right(Hex("0" + CLng(v(i))), 2)
>>> Next
>>>
>>> Try what you posted yesterday in my code samples to see for yourself!
>>> This works: Right(Hex(256 + CLng(v(i))), 2)
>>> This does not: Right(Hex("0" + CLng(v(i))), 2)
>>>
>>> I'm just working with Hex/Dec for the first time, and so I'm relying on
>>> you folks for guidance. I feel I do a pretty thorough job of testing my
>>> stuff before using it (most times, anyway). That process also includes
>>> testing offerings from others in context to my usage needs. Up to now,
>>> I've relied on Excel's Hex2Dec and Dec2Hex functions to do all the
>>> 'behind-the-scenes' stuff. Please know I appreciate your efforts AND
>>> patience. It has made me a better VB6 programmer than I was before this
>>> got started.<bg!> Props to all who have contributed...
>>>
>>> regards,
>>>
>>> -- Garry
>>>
>>> Free usenet access at http://www.eternal-september.org
>>> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>>>
>> You are mixing it up.
>> This is *not* what I posted : Right(Hex("0" + CLng(v(i))), 2)
>> This is *what* I posted : Right$("0" & Hex$(14),2)
>>
>> See the difference?
>>
>> /Henning
>
> Yes, I see the difference! It's not the syntax I was referring to; it was
> the concept of substituting "0" for '256' in MY CODE. Sorry for any
> misunderstanding here, but I am NOT mistaken since I acknowledged
> yesterday that your code (as posted) worked for that particular HexDigit,
> but when I substituted "0" in MY CODE (as you implied) it did not work.
> That could very well be because of my lack of knowledge in this area, and
> so in no way was I inferring your code was bad. -I just didn't know enough
> at that point about what I was into.
>
> Again, I thank you for your persistence and patience with trying to help
> me. -Much appreciated!
>
> --
> Garry
>
> Free usenet access at http://www.eternal-september.org
> ClassicVB Users Regroup! comp.lang.basic.visual.misc
>
>

It's just that the "0" is in the wrong place in you code. It should have
been: Right("0" & Hex(CLng(v(i))), 2)

Happy to be to any help :)

/Henning