?
Solved

Very simple problem but I am too stupid :(

Posted on 1998-09-05
3
Medium Priority
?
158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

649 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