Solved

Very simple problem but I am too stupid :(

Posted on 1998-09-05
3
150 Views
Last Modified: 2010-04-30
******************************************
Declerations:
DIM Screen(20) as String

Private Sub Command1_Click()
For H = 1 To Picture1.Height - 15 Step 15
For W = 1 To Picture1.Width - 15 Step 15
Colorvalue$ = Right$("0000" + Hex$((Picture1.Point(W, H))), 6)
Blue = Val("&H" + Mid$(Colorvalue$, 1, 2))
L$ = L$ + Chr$(blau)
Next
Command2.Caption = Int((H / Picture1.Height) * 100) + "%"
Next
Screen(1) = "Hallo"
End Sub
***************
Why I get "Laufzeitfehler 13 - Typen unverträglich!" ???
0
Comment
Question by:Okano
3 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 1433219
Blue = Val("&H" + Mid$(Colorvalue$, 1, 2))
    L$ = L$ + Chr$(blau)

The VAL statement cannot accept "&Hxxxx" as an arguement so BLUE is forever returning zero. CHR$() will generate an error when passed a zero.

I see it looks like you're trying to convert a hex string color value back into a numeric. Your approach will not work. Try:

MSN$ = ucase$( mid$( colorvalue$, 1, 1) )  ' Get MS digit
LSN$ = ucase$( mid$( colorvalue$, 2, 1) )  'Get LS digit
hx = "123456789ABCDEF" 'Position in string corresponds to hex value, zero not used
value = instr( hx$, msn$ ) * 16 + instr( hx$, lsn$ )   'Value will have decimal equiv of hex


0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1433220

Command2.Caption = Int((H / Picture1.Height) * 100) & "%"

Not  100) + "%"

Give points to  mark2150 if answer is accepted
0
 

Expert Comment

by:dbardi
ID: 1433221
Both '+' and '&' will work.
The norm is to use '&' to avoid confusion with numeric calculations.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now