OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-02-2008, 08:50
Gadget
Guest
 
Posts: n/a
Unhappy Basic array/control question

Searching the internet for an applicable solution {without much luck}, but basically the problem is this:

I have eight radio buttons. Each is named acording to a compass point.

I want to tic the correct one based on input elsewhere.

I would like it to work like this...

Code:
Dim OptB(7) as string
Dim LintN as Long
Dim DblAngle as Double

    'Populate the array with option button names
    OptB() = array("OptE,OptNE,OptN,OptNW,OptW,OptSW,OptS,OptSE",",")

    DblAngle = Int(GetAngle(X, Y))
    LintN = Int(DblAngle / 45)
    If DblAngle / 45 = LintN then Controls(OptB(LintN)).Value = True
... but how do I get the damn option buttons to work?

Last edited by Gadget; 06-02-2008 at 08:53.
Reply With Quote
  #2  
Old 06-02-2008, 08:55
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

probably the only problem is to set previously enabled option button to false
Reply With Quote
  #3  
Old 06-02-2008, 10:21
Gadget
Guest
 
Posts: n/a
Default

Don't need to: they are option buttons - if one is true, the rest are false.

For some reason I can't set the array?
Reply With Quote
  #4  
Old 06-02-2008, 10:25
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

how about F8-debugging through the code - and using Expression Evaluation (Shift-F9 / immediate window / Watches) for every variable/expression used?

btw, the correct way to load a string array is this:
Code:
Dim OptB() as string
OptB=split("OptE,OptNE,OptN,OptNW,OptW,OptSW,OptS,OptSE",",")
Reply With Quote
  #5  
Old 07-02-2008, 03:49
Gadget
Guest
 
Posts: n/a
Default

Cool - got it working now; I think that was it (Thanks).

Is there a more streamline way of populating the array? within the Dim statement? Any time I've tried I get errors saying it won't do it. (... or I'm doing it wrong... naaaa can't be me )



Now I just need to get a line drawn on the form to join the mid point to the radio button
Reply With Quote
  #6  
Old 07-02-2008, 06:23
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

"split" is the ultimately fast function, there is no other way in VBA to populate a string array in one statement

drawing on userform is provided by SCPRTL20
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ETC Question!!!! [Please~~~~~] ljesus7 CorelDRAW/Corel DESIGNER VBA 2 08-03-2007 06:45
Urgent Help: Alex: with Corel VBA and Visual basic program amollondhe CorelDRAW/Corel DESIGNER VBA 1 23-11-2006 08:57
Visual basic and text box Mark Hockert CorelDRAW/Corel DESIGNER VBA 0 08-06-2006 14:19
A background-related question... Rincewind General 1 28-06-2005 13:38
CPP12, background question Ghidrah General 5 09-06-2005 23:11


All times are GMT -5. The time now is 02:32.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com