Line Method Explanation?

G

Guest

I would appreciate if someone would explain how the line method works?

I understand how to use the line method and get it to do what I want. It’s
just the Line method’s syntax in comparison to the standard syntax of all
other methods is very peculiar!

The VB Help defines the syntax as follows:

expression.Line(flags, x1, y1, x2, y2, color)
flags Required
x1 Required
y1 Required
x2 Required
y2 Required
color Required

the VB Help then goes on to give an example and calls the line method like
this:
rpt.Line(sngTop, sngLeft) - (sngWidth, sngHeight), lngColor, B

a) Where is the Required flag?

b) Unlike what it appears from the VB Help definition, if you don’t put a
closing bracket after ‘y1’ as the example does, you get an error!

c) Normally you don’t need any brackets when passing in parameters to a
method, unless you expect a return value?

d) What is this ‘) - (‘ doing in the middle of the parameter list?

e) rpt.Line(sngTop, sngLeft) - Step(sngWidth, sngHeight) How does the ‘step’
keyword accomplish what it does, i.e. height and width of the line, as
opposed to the x2 and y2 positions? It’s not a function?

f) The ‘B’ at the end of the VB Help example (which isn’t even mentioned in
the VB Help explanation), is this the flag mentioned at the beginning of the
definition?

(Just for the record, B tells the line method you want a rectangle/Box, and
BF tells the line method you want a Filled In rectangle/Box).

g) Normally, when you pass in characters to a method (sub or function), the
characters are either a variable, a constant, or you put quotation marks
around it and pass them in as a string. What is going on with the ‘BF’?
 
G

Guest

Thank you. That did answer most of my questions.

expression.Line(Step(x1, y1) – Step(x2, y2), color, BF)

From this it appears that the Line method has tree parameters.
What still surprises me though is the first parameter. Step(x1, y1) –
Step(x2, y2)

If I were to create my own method i.e. a subroutine in a class module, how
would the definition of my subroutine look like, if it is to require such
syntax?
 
G

Guest

Douglas,

I hope this reply to an old post reaches you.

The help file you provided gives the right syntax for calls to the line
method in Access 2003 VBA, and I used it directly in reports several months
ago.

Now I'm trying to create a COM callable library function in VB.NET. This is
going to be a common library called by a lot of Access database projects to
add some custom drawn objects to a report. I pass in the report object to a
function as Microsoft.Office.Interop.Access.Report. Within that object, the
syntax for the line method is

Public Overridable Sub Line(ByVal flags As Short, ByVal x1 As Single, ByVal
y1 As Single, ByVal x2 As Single, ByVal y2 As Single, ByVal color As Integer)

I can't find any help for the values in this function anywhere. I don't
know what the meaningful values of 'flags' are, what the units shoudl be for
the positions, etc. I can get the function to draw some lines on the report,
but they certainly are behaving strangely.

Can you help?
 
D

Douglas J. Steele

I'd suggest asking in a newsgroup related to VB.Net, such as
microsoft.public.dotnet.languages.vb
 
G

Guest

Thanks, I'll try that. I'm not optimistic. I don't think this is a vb.net
documentation problem, as there is no line method in vb.net. Documentation
on the Access interop layer seems to be non-existant.

I did find the following in a related example. This may be useful to the
next person.

flags = 6
=> line (X1, Y1)-(X2, Y2), color

flags = 22
=> line (X1, Y1)-(X2, Y2), color, B

flags = 38
=> line (X1, Y1)-(X2, Y2), color, BF

I have tested the last of these and it works, so I presume the rest work.
This will get me past my current problem, but real documentation would be
preferable to magic numbers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top