Solved

Very simple problem but I am too stupid :(

Posted on 1998-09-05
3
153 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 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

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 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