|
Typically the folks here will not do your homework for you. Everyone here is extremely helpful providing you do your own research first and when you get stuck, then post your question along with a detailed explanation and you will get a prompt response.
My suggestion is to do some research first (Google it), then come back when you get stuck.
Good luck.
|
|
|
|
|
Wait, you're serious? Wow, I thought the previous post was a joke... Who in their right mind would try to do all of that in VB6?
|
|
|
|
|
I understand you're new around here. Please stick to a single thread as long as you're on the same subject, so don't hit "New message" all the time, just hit "Reply" when you want to reply to something someone has answered to one of your earlier posts.
As I said before, VB6 is not the best choice, but I understand there may be reasons for that choice. It will limit the amount of useful reactions you may get. I for one don't have any VB6 code, program or tool around. Parallel ports are a bit ancient too, my systems don't have any. There used to be an "inout.dll" file that did some input/output magic, back in time when Windows still let you do anything you wanted; not sure that DLL would be acceptable to Win XP, I'm pretty sure Vista/Win7 will dislike it.
And then there is the matter of responsiveness. In my opinion Windows isn't capable of providing smooth steps to a stepping motor. It you wire it up, the result will be jerky and loud, as no pulse will have a reasonably accurate position or width. In order to control a stepper motor, you need a micro-controller (with or without a very simple kernel), and not a mighty CPU with a massive operating system that lacks real-time qualities.
|
|
|
|
|
Take a look on the coding4fun[^] blog; they've got a section on hardware-projects, being complete tutorials that could be inspiring.
Are you sure that your school accepts VB6?
I are Troll
|
|
|
|
|
First, I'd seriously question the quality of the school yuo're going to if they are still teaching in VB6.
Second, in order to get a stepper motor to work reliably, and allow your code to do other thing while the motor is turning, you need to go with dedicated hardware, like the stuff you find as Phidgets.com and TrossenRobotics.com.
If you tried to do this in your VB6 code, you'd be able to turn one motor only and do nothing else until your code stopped the motor.
|
|
|
|
|
i am actually working on my final year project which is a pc-based fruit sorting system which involves computer vision.i am trying to use my program in vb to do all tasks involved.can you help me please?
|
|
|
|
|
VB6... Gotta mention that it's VB6... Otherwise you ruin the joke
|
|
|
|
|
No no, the joke is intact. It just got a tiny bit more subtle.
|
|
|
|
|
can anyone help me with codes to control a stepper motor in visual basic 6 via the parallel port?
|
|
|
|
|
No thanks, for all kinds of reasons:
1. VB6 is dead. However they forgot to bury it.
2. Parallel ports are rare.
3. A Windows system is too expensive and Windows itself too slow to step a stepper motor.
What you must do is have some stand-alone intelligence that creates the steps (or microsteps), and accepts macroscopic commands (e.g. ramp up linearly from velocity1 to velocity2 in x seconds) over a rather modern and cheap interface (e.g. RS232C or USB), and provides all necessary safety precautions (e.g. a set of microswitches breaking all power in an emergency).
|
|
|
|
|
Luc Pattyn wrote: VB6 is dead. However they forgot to bury it.
You have to shoot it in the head or cut off its head to stop it.
Man, study the works of George Romero or else you are lost when it comes to the worst!
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
I'm quite familiar with Romero's work, thanks; I'm not afraid of a little VB6, I just don't keep it around nor do I offer any assistance.
Smithers-Jones wrote: You have to shoot it in the head or cut off its head to stop it.
Nah. I just prefix a little Option Strict On and I'm pretty sure it stops compiling.
|
|
|
|
|
can anyone help me with codes to control a stepper motor in visual basic 6?
|
|
|
|
|
Hi,
Throughout my application I have several ComboBoxes which are data bound to a collection of objects (uaually a generic list). Because the user needs the option to not select an item in the Combobox I need an empty item at the start which says something like "Please Select".
The way I am doing this currently is to add an extra object to the start of my collection which gives me what I want. However, because a lot of these Comboboxes are bound to a collection of objects that are built when the application starts and remains in memory for the duration of the users' session, it means that my collections have an extra object in them which is causing problems elsewhere in the application.
Is there any other way of inserting an item into the start of a combobox that is bound to a collection of objects?
I hope this makes sense, if not then please let me know and I will try to clarify. Thanks for your time.
Jay
|
|
|
|
|
How about creating a wrapper class over the list, that adds the null element?
Just need a class that implements IList<whatever> and passes all operations through to the underlying list, except that it returns a count one higher than the list count, subtracts one from all provided indices, and returns null for element #0.
|
|
|
|
|
OK, thanks a lot. Sounds like a good idea, will give it a go tomorrow.
Thanks again for your help
|
|
|
|
|
Hi guys,
i have a vb.net application that watched a folder and whenever a rtf file is dropped i want to read the text an save it to a txt file.
here's my code
Dim word_app As New Microsoft.Office.Interop.Word.Application
Dim word_doc As New Microsoft.Office.Interop.Word.Document
word_doc= word_app.Documents.Open(in_file, False, True, False, , , , , ,Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatRTF)
word_doc.ActiveWindow.Selection.WholeStory()
word_doc.ActiveWindow.Selection.Copy()
str = My.Computer.Clipboard.GetData(GetType(String).ToString)
'word_doc.SaveAs(out_file, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatText)
doc.Close(False)
word_server.Quit()
Dim sr As New IO.StreamWriter(out_file, False)
sr.Write(str)
sr.Close()
this is running on the a windows 2008 rc2 server as a window service.
the error messaage is "Object reference not set to an instance of an object"
if there is another simpler way please advise.
thank you kindly
Anoop
|
|
|
|
|
Hi,
the line which reads
doc.Close(false)
should that be
word_doc.Close(false)
And also, you have an object named word_server, where is that declared?
|
|
|
|
|
hi,
sorry i tried to make it more readable for you guys. i seemed to have mis-renamed the var on this snippet.
thanks
|
|
|
|
|
I suggest you forget about Word and experiment with a RichTextBox. You could set its Rtf property to load the RTF file content; then get its Text property. I haven't done this at any length, however the doc seems to suggest it would return the document content without any markup.
BTW: IMO the RTB does not have to be visible, nor part of any Form for this.
PS: As there are different levels of the RTF specification, it could happen that Word is more capable than an RTB, so complex documents might fail. I just don't know, I wish I did.
|
|
|
|
|
agreed, here is the function you can use..
Sub convertRTFtoText(ByVal in_file_path As String, ByVal out_file_path As String)
Dim rtb As New RichTextBox
rtb.LoadFile(in_file_path) 'this is your rtf file path
IO.File.WriteAllText(out_file_path, rtb.Text) 'this is your txt file path
End Sub
|
|
|
|
|
thanks,
i have used something similar.
Me.RichTextBox1.LoadFile(in_file)
Dim sr As New IO.StreamWriter(out_file, False)
sr.Write(Me.RichTextBox1.Text)
sr.Close()
thanks guys!
|
|
|
|
|
Hi,
I'm a bit of a lurker around here, love reading the articles, but as I'm not a programmer in anything other than the loosest of definitions, am unable to contribute much. I ask your indulgence with the following:
My 'programming' until now has been largely in VB (6 and earlier) and mainly done to fill some gap in the OS, or other specific need. I'm actually proud of many of these little utilities as many of them have continued to make my life easier for many years, despite being constructed in something of a spaghetti fashion - copying of other peoples code (leagally!) plus my own.
I have my own IT consulting business, supporting several hundred users across many small businesses and some of these programs are still in use. It is becoming obvious though, particularly as we move to Windows 7, that many of these old programs really should be reconstructed in a modern language. Additionally, there is a need for some new types of tools for use in our business. With a lot of help from the code samples on this site, I have even created my first such project - about 2000 lines of VB.Net code. The program works well, but I'm certain that it would seems 'confused' to an experienced eye.
I'm keen to get a bit better/more confident/maybe faster at this programming caper and have some basic questions - but I don't want to kick off any religious wars . I'm thinking that the best way to acheive this is to purchase a book and read it, but which book...
- VB.Net/C#.Net - I've mostly done VB 6 in the past, but C# code does make some sort of sense to me.
- Development environment - Visual Studio Express/Pro/Sharp Develop (why did they drop standard?). I need add-ins, services, probably the ability to create Office Add-Ins. I think that means I need to get VS 2010 Pro, or can Express do this stuff, its just templates, any thoughts?
- Winforms/WPF/WCF - I barely understand the differences, I feel I'll mostly use Winforms. How do you decide which is 'best'. Don't believe there will be much need for web based apps.
Lastly, this will probably be covered by simply learning the language/environment better, but .Net often has several ways to achieve what seems to be the same result. How do you know the best way, and determine the best layout for a project - this function in module x, that one in module y.
I know this is long, I'm sorry.
Thanks,
Rod
|
|
|
|
|
RodClark wrote: - VB.Net/C#.Net - I've mostly done VB 6 in the past, but C# code does make some sort of sense to me.
This is largely a matter of preference. But, there are little things that VB.NET does that C# can't (yet) and things that C# does that VB.NET can't do (unsafe code, pointers, ...)
The books are going to be language specific but cover the same topics. But for a newbie, I'd tend to lean toward C#.
RodClark wrote: - Development environment - Visual Studio Express/Pro/Sharp Develop (why did they drop standard?). I need add-ins, services, probably the ability to create Office Add-Ins. I think that means I need to get VS 2010 Pro, or can Express do this stuff, its just templates, any thoughts?
If you're doing Office Addins, plugins, services, ... I'd go with the Pro edition instead of Express. Express has limitations that are not because of an absense of project templates.
RodClark wrote: - Winforms/WPF/WCF - I barely understand the differences, I feel I'll mostly use Winforms. How do you decide which is 'best'. Don't believe there will be much need for web based apps.
Winforms is pretty much what you've been using in the older versions of VB. WPF is an entirely different way of creating Windows applications that isn't as restricted to the "fill in forms" methodology of Windows apps. WPF lets you create much richer UIs for your apps, but the learning curve is pretty steep. Which one is 'best' is determined by your apps requirements and your choice.
The choice is up to you and your project. Most utilities are not going to benefit too much from WPF...
WCF is Windows Communication Foundation and it handles communications between applications and services.
RodClark wrote: Lastly, this will probably be covered by simply learning the language/environment better, but .Net often has several ways to achieve what seems to be the same result. How do you know the best way, and determine the best layout for a project - this function in module x, that one in module y.
You only get this with lots of experience in object oriented design and very good requirements gathering. There is no way for anyone to describe how to determine the 'best' way to solve any one problem. The 'best' method can change with the smallest requirement change in your app. It comes down to the set of problems you're trying to solve and knowing which techniques are going to work better in each situation. Again, lots of experience.
|
|
|
|
|
RodClark wrote: I'm thinking that the best way to acheive this is to purchase a book and read it, but which book...
I found the Head First[^] series a good read, though it's more a learn-by-doing style book. It's not a book you'd read in the train, unless you have a compiler at hand. Another good reference would be the How Do I-video's[^] on MSDN.
RodClark wrote: VB.Net/C#.Net - I've mostly done VB 6 in the past, but C# code does make some sort of sense to me.
How 'bout going for C#, and googling for the matching VB.NET syntax to compare it to? Seeing the same construction through two different glasses helps.
RodClark wrote: I think that means I need to get VS 2010 Pro, or can Express do this stuff, its just templates, any thoughts?
If I recall correctly, you'd need the Pro version to use the VSTO (Visual Studio Tools for Office) extensions. The Pro-version also allows to add in helpful extensions like Resharper, giving helpfull tips in the IDE.
RodClark wrote: Winforms/WPF/WCF - I barely understand the differences, I feel I'll mostly use Winforms. How do you decide which is 'best'.
The YAGNI[^]-princple would be the first filter. What's "best" depends on your circumstances - the man on the northpole will have different demands from a man in the desert. Go with what you're comfortable with, and read up on the new things when you have some spare time to kill. Once you discover some new area that's important to you, indulge.
RodClark wrote: How do you know the best way, and determine the best layout for a project - this function in module x, that one in module y.
I have to admit that I often don't know the best or recommended way.
Most (larger) programs are modular, and even the smaller ones tend to share a library with functions. As time passes, things get updated. The first step toward a cleaner architecturing was learning the OO-concepts, the second was learning design-patterns. What helped most overall, was reading code from articles on sites like this one.
RodClark wrote: I know this is long, I'm sorry.
Have a long answer as revenge
I are Troll
|
|
|
|
|