|
I have a class which keeps track of a few circles and draws them in a row using Worksheet.Shapes.AddShape
I was quite happily calling member functions and running them from a module with no problems. Then I tried to implement a form to take input (how many circles, size, position etc) and pass it to the class and have it drawn. I just used a handful of TextBox controls. A button is used to copy all the textbox values when pressed, and pass each to the class. Everything worked as before, except that the first circle in the row will never be drawn. The other circles will be drawn in exactly the right position as if there had been a first circle, but instead there is a blank space.
I have isolated the variable which is passed to the class which causes the problem - it is the x position on the sheet. I have used the locals window to check what value is passed to .AddShape and it is exactly the right value of 400. Yet the circle never appears. Change the button function to call 400 instead of taking the same value from the form, and it is back again.
I have tried passing the variable by value which I would have thought would make the two cases indistinguisable to .AddShape. No luck. I have checked pretty thoroughly that the circle is not just being drawn in the wrong place or somewhere else.
So I give up. Any suggestions would be greatly appreciated, even/especially the general debugging approach you might use for something like this (bear in mind I am a certified newbie....)
Thanks
|
|
|
|
|
Hi guys,
Is there a way to send key-strokes messages to other apps. Current senario; I usually open a MS Word, GFX editor etc. What I want the VB code to do is; I press a button -> VB tells All Open MS-Word, GFX editor etc. that Ctrl-P has been pressed, for example. Anyway to do this?
|
|
|
|
|
I guess you could do it with API's: EnumWindows and SendMessage. VB have a native SendKeys statement, but you will still need to use EnumWindows to get all the window handles...
|
|
|
|
|
|
How can I create a form programmatically without having any form
in my project in the first place.
That means without using reference for an existing form.
Instead referencing directly the Form object.
Pilgrim
|
|
|
|
|
In visual basic 6.0 we cannot create any control dynamically without having reference with existing object.
|
|
|
|
|
It is true for the forms - they cannot be created without a reference to existing form. However, you *can* create other controls without references to existing controls. Following code works:
Dim txtTest As TextBox
Set txtTest = Controls.Add("VB.TextBox", "txtTest")
txtTest.Move 100, 100, 1000, 300
txtTest.Visible = True
|
|
|
|
|
|
I have two questions, when I print using the Textout method
I always get the default printer setting. I would like to
change the style of the print, lets say MODERN Or SWISS, how can I do that. Also is it possible to change the print
styles while the doc is printing. Lets it starts in times roman and then goes to arial or a larger size. Can this be done with textout or do I have to use The Draw text method
to do this? If so how?
|
|
|
|
|
Printer.Font
Regards!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
So how would I code this in C++?
|
|
|
|
|
Peter, You posted your question under something called Visual Basic Forum...;)
I thinked that because you put in the previous question the function TextOut...
Printer.Font is a function in VB.
But How I love VC++ And hate VB I will answer you...
TextOut use the current Font...
For select the font must to use
CDC::SelectObject
Regards...;)
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hi all,
I have to make new report with Crystal Report , i have problem in that, too !!!
Look at the my Tables and Fields with examples ...
Table -> PERSONS
Fields ->
PID (Number value)
PNAME (Text value)
PFAMILY (Text value)
and etc.
Example:
1 - Hadi - Rezaie
2 - Ali - Arabi
3 - Hasan - Varchaghi
Table -> OPERATE
Fields ->
PID1 (Just can save PID data in PERSON table)
POPERATE (Yes/No)
PID2 (Just can save PID data in PERSON table)
Example:
1 - Yes - 3
1 - No - 2
2 - Yes - 3
3 - No - 1
I wanna show thease information in my report like thease:
Person name: Hadi Rezaie
Operation list:
Hasan Varchaghi - Yes
Ali Arabi - No
Hasan Varchghi - No
Please look at the 1 number in OPERATE table,
If 1 is in first column then report must show the information of number which is in second column ...
If 1 is in second column then report must show the information of number which is in first column ...
How can i do it ?
Please help me ! HELP ME !!!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I´ve got a really strange problem
One of the windows in my app (´mdi app) has a vertical scrollbar, if I run the app within Visual Basic (by pressing F5) I can scroll the window content with the mousewheel but if I create an exe-file and run it from Windows Explorer I can´t (if I click the arrows on the scrollbar the window content is scrolled). Does anybody know what could be wrong????
Olle
|
|
|
|
|
The help file says VB uses pass-by-reference as a default(byval to use pass by value) - but the simple test I do in an Excel module isn't working
Public testnum
-----
Public Sub makebig(inpt)
MsgBox "Make big receives = " & inpt
inpt = inpt + 1
MsgBox "Input now is = " & inpt
MsgBox "testnum now is = " & testnum
End Sub
---
Public Sub test()
testnum = 1
MsgBox "Before = " & testnum
makebig (testnum)
MsgBox "After = " & testnum
End Sub
test() does not change testnum, Before = 1, After = 1
what is happening?
Thanks heaps
|
|
|
|
|
Change line that reads:
makebig (testnum)
to
makebig testnum
If you use parentheses here it assumes that parameter you pass is not a variable but a result of an expression. Therefore instead of passing address of your testnum variable it passes an address of the result of the expression.
|
|
|
|
|
Try this
<p>Option Explicit</P>
<p>Public testnum As Integer</P>
<p>Public Sub MakeBig(inpt As Integer)
MsgBox "Make big receives 'inpt' = " & inpt, vbOKOnly, "In MakeBig()"
inpt = inpt + 1
MsgBox "'inpt' now is = " & inpt, vbOKOnly, "In MakeBig()"
MsgBox "testnum now is = " & testnum, vbOKOnly, "In MakeBig()"
End Sub</p>
<p>Public Sub Test()
testnum = 1
MsgBox "The original value of testnum = " & testnum, vbOKOnly, "In Test()"
MakeBig testnum
MsgBox "After MakeBig()= " & testnum, vbOKOnly, "In Test"
End Sub</p>
Paul Lyons
Do not go where the path may lead, go instead where there is no path and leave a trail.
- Ralph Waldo Emerson
|
|
|
|
|
I'm somewhat new to vb, although i feel like i know what im doing. I have a external program (not a excel macro) that I want to load a comma delimited file into. I need to load it and add up a few fields. Nothing complicated I'm sure, but I need some help on how to load the file into a excel worksheet (or whatever is best to do it with). Thanks in advance if you can help.
|
|
|
|
|
Instantiate an Excel Application object (try get before you try create) and use the Excel object model to load the CSV.
If it was me I'd use the filesystem object (part of scripting) and then parse it with the Split function into an array or some such, but I gues that dependes on where and what you want to do with the data.
|
|
|
|
|
In internet explorer when we type in the url at address bar then we get a list of dropdown of urls (guesing that they are coming from the registry). I have created a combobox in vb, i want whatever new entry is entered in the combo box should be added to registry and also the earlier entries should be visible when we click the dropdown of the combo box.
|
|
|
|
|
It may not be a good idea to store it in the registry. Probably saving a certain number say 10 - in a local file should serve the purpose. But if you need to store that in registry - see GetSetting() function.
|
|
|
|
|
Hello fellow developers!
I have a problem. I am trying to optimize some database transfer code and I am stuck.
Here is a brief introduction to what I have today:
The database is a Jet 3.5 database with a lot of tables. The tables I want to update are linked together like this (PK):
Shelf(ShelfNr)-->Inventory(ShelfNr,ArticleNr)<--Article(ArticleNr).
ArticleNr is a unique number but ShelfNr is based on an auto-counter field. The problem with this that I cant use batch updates (through an ODBCDirect workspace) and at the same time use code like this:
' Pseudo VB-code
rsShelfTo.AddNew
' copy all fields except key
rsShelfTo.Fields = rsShelFrom.Fields
rsShelfTo.Update
rsShelfTo.Bookmark = rsShelfTo.LastModified
' CurrentShelf always gets the value 0 with this code, why?
CurrentShelf = rsShelfTo.Fields("ShelfNr")
I would like to include all updates in a transaction some my question is can I switch between using dbUseClientBatchCursor and dbUseDefaultCursor and still keep the transaction alive?
Any ideas?
--
Mattias Wahlberg
IDNet
|
|
|
|
|
Hello,
I've got a problem regarding PowerPoint XP. In Office 2000 the following lines worked just perfectly:
Dim ppApp As PowerPoint.Application
Set ppApp = New PowerPoint.Application
With PowerPoint XP I always get the error message: "ClassFactory cannot supply requested class". It works fine in VBA (code entered directly in PowerPoints VB Editor) but not from Visual Basic.
Can anyone help?
Thanks,
Ruediger
|
|
|
|
|
I am planning to make a pretty big program (compared to what I have done already) and I am pondering the possibility of creating the program so that it can use plugins. What I am wondering is if this is a reasonable/easy type of thing to do. And is it really worth it in most programs. I am planning to make the program fairly dynamic as it is. (dynamic being synonyms with generic)
Either way I am also wondering if anyone can point me in the direction of a good resource on how to make a program that can use plugins.
Thanks for any help and advice you give
Quinn
(a.k.a Monkey Joe)
|
|
|
|
|
Has anyone created an email server using VB? Is it even possible to do without killing server resources? I want to write one, a plain one, nothing fancy, just a basic email server to send and receive email, maybe a web interface, for few users (maybe 5 max users). Any links or anything out there to try and do this?
-Nick
|
|
|
|