|
What you saying humm?
I remember humm everything as if humm it was only yesterday humm!
Everyone knows that once the humm. Sorry, nap time.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Christian, (i'm sure i'll get slammed for this but...)
I'm confused by your question of "Why are you using VB6". While I agree that vb6 and dotnet are night in day in comparison, I'm sure you aware that a developer's tools are not always up to them. If his company has many many applications written in vb6, then it's not always possible to do a mass conversion spending time and resources to do so...finding alternatives to ocx's that were being used, ramp up time learning dotnet stuff replacing the vb6 etc. Not to mention the amount of testing that would need to occur testing the new versions of an existing app as well as possible distribution considerations (installing the app and ms framework on possibly thousands of computers).
Now if the above is not the case and the developer went into vb6 willingly then yes he should be questioned on his choices.
My company has a website written with asp and vb6 dlls. Website has thousands of pages on it and would take years to rewrite in asp.net. $$$$ talks and other projects are more important...
Don't hate me Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
nlarson11 wrote: I'm sure you aware that a developer's tools are not always up to them.
Agreed. Yet, unless this is a legacy project, the question may become, why does your work use VB6 ?
nlarson11 wrote: Now if the above is not the case and the developer went into vb6 willingly then yes he should be questioned on his choices.
And that's why I asked why he's using it, rather than flat out saying 'you should never use VB6'. I know sometimes people have to use it, but I'd say the majority of people I ask that to, on these forums, are not in that boat. A lot actually are surprised they can get VB.NET for free, and are happy to hear it.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
vb6 does not expose that itself. You will need to use an API call to check the status. just google "how to check printer status in vb6". it will give you the results you ask for.
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Hi
If you know the Answer, try to help others. This is the Area where we share knowledge. This is not to fight each other. right ?
Thanks for understanding.
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
|
|
|
|
|
Hi,
I know this question is posted million of times and i search on the internet for very long time for the solutions but to no avail.
I want to create a table (called "Customers") in a Microsoft Access database and then insert/delete records into the table and update the table. The table shall have 3 columns:
ID
Customer Name
Customer Address
I know i need to make the "ID" column as an autonumber and a primary key, as i need to insert and delete records and update the table.
I am using the Visual basic 2008 Express edition and quite familar with the OledBcommand. I greatly appreciate if there is any kind, helpful and generous expert out there who can advise me the VB code for this using "Oledbcommand".
Thank you very much.
|
|
|
|
|
If you issue the following command to the Access database, using the oledbCommand and ExecuteNonQuery
CREATE TABLE Customers ([Id] COUNTER, [Customer Name] TEXT(60), [Customer Address] TEXT(255))
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi Steve,
I need the [Id] to be primary key, as i need to insert new records and delete records into the Access database table and finally update the Access database table.
The code:
" CREATE TABLE Customers ([Id] COUNTER, [Customer Name] TEXT(60), [Customer Address] TEXT(255)) "
seems does not make [Id] as primary key.
Pls kindly advise me. Thanks.
|
|
|
|
|
|
Hi All,
I built a program for Creating Entry for running my application to startup. But windows defunder shows it spyware.
Description:
This program has potentially unwanted behavior.
Advice:
Permit this detected item only if you trust the program or the software publisher.
Resources:
regkey:
HKLM\Software\Microsoft\Windows\CurrentVersion\Run\\ABCD
runkey:
HKLM\Software\Microsoft\Windows\CurrentVersion\Run\\ABCD
file:
D:\Program Files\ABCD\ABCD.exe
Category:
Not Yet Classified
So please give me the solution for resolving this problem.
If you can think then I Can.
|
|
|
|
|
ignore defender, or abandon this functionality. IF you want to make your app run on startup, put it in the startup group of the start menu.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
The was tagged as "Potentially unwanted" because applications normally do not modify the Run key. Really, the only time that key should be modified would be at installation time of your app, not run-time.
|
|
|
|
|
you know what i knew that you would post a post like this
sooner or later since you posted a post about sendkeys
are you trying to develop something malicious?
TheMrProgrammer
|
|
|
|
|
And why are you asking me this? Reply to the OP on his post, not mine.
|
|
|
|
|
i ahve a windows(desktop) application softwere which i am working on,
I need to add functionalty in that, like when you minimise you can store tool bar on the taskbar.(like windows media player)
it can be done with VC++ ,VB.NET
any suggetions?
|
|
|
|
|
Here[^]
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I searched and tried several answer from yesterday but i could not solve this yet... Other thing is i am a beginner...
I am trying to update the StatusStrip from a class but it's not updating... Here's my code.
This is my Form1----------
Public Class Form1
Public trash As New Class1
Private WithEvents eventsUpdateSSclass1 As UpdateStatusStrip.Class1
Private Sub UpdateStatusStrip(ByVal msg As String, ByVal color As Color) Handles ventsUpdateSSclass1.UpdateStatusStrip
Me.ToolStripStatusLabel1.Text = msg
Me.ToolStripStatusLabel1.BackColor = color
Me.StatusStrip1.Refresh()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
trash.runRunRun()
End Sub
End Class
This is my Class ------------
Public Class Class1
Public Sub New()
End Sub
Public Event UpdateStatusStrip(ByVal msg As String, ByVal color As Color)
Public Sub runRunRun()
Dim k As Integer = 0
For i As Integer = 1 To 100
For j As Integer = 1 To 1000
k = j + i
RaiseEvent UpdateStatusStrip(CStr(k), Color.Orange)
'call UpdateStatusStrip(CStr(k), Color.Orange) is not working.
Next
Next
RaiseEvent UpdateStatusStrip(String.Empty, Nothing) 'to check
End Sub
End Class
I will really really appreciate your help.
|
|
|
|
|
Hi,
all Control operations need to be handled by the GUI thread, so if you have one handler (here a button click handler) taking too long, the user will be left in the dark until that handler is done, and the GUI thread can continue doing its business, such as updating statusstrip texts.
What you should do is delegate long-winding stuff to some other thread(s); and when they suddenly need to access a Control, you would then need the Control.InvokeRequired/Control.Invoke pattern (except inside the BackgroundWorker.Progress and Completed handlers).
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Thanks for getting back so fast!!!
Could your please help me little further? This post talks very similar to your suggestion but being a beginner i could not make it work.
Could you please show me how to do this? I tried converting the C# to VB but run out of luck
Thanks again.
modified on Thursday, June 18, 2009 6:34 PM
|
|
|
|
|
Hi,
I am willing to help at very specific problems, not at teaching someone the fundamentals. There are lots of books, articles and documentation for that. So I won't provide the fish, I'll give you some pointers on fishing yourself.
Here are a couple of things you might study to become familiar with BackgroundWorker:
- a page from MSDN: http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[^]
Make sure to set the language filter to VB.NET; copy the source, build and run the example, study it.
- an article, describing a real application (not very simple)VB.NET Background File Downloader[^]
Depending on your current software skill level, that may do it. If not, I strongly recommend you go to a book store, look at a couple of VB.NET books, buy the one you like most, and study it systematically.
Also, learn to search, either with Google or with the CodeProject search engine. That is how I found the links I provided...
Happy learning!
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
I'm writing an application that launches executables with parameters.
After the user defines the path, name and parameters I launch it using System.Diagnostics.Process
The problem I'm facing is that while my application waits for the process to end it uses too much CPU. In my test computers, which are Core 2 Duo, it uses 40-50% everytime it enters the Do until loop I created.
Here's the code:
Dim varProcess As New System.Diagnostics.Process
Dim varID As Integer
Try
If comboParams.Text = "" Then
varProcess.StartInfo.FileName = txtPath.Text
varProcess.Start()
varID = varProcess.Id.ToString()
Else
varProcess.StartInfo.FileName = txtPath.Text
varProcess.StartInfo.Arguments = comboParams.Text
varProcess.Start()
varID = varProcess.Id.ToString()
End If
Do Until System.Diagnostics.Process.GetProcessById(varID).HasExited = True
cmdRun.Enabled = False
Me.Text = "Launch " & "PID: " & varID
Loop
Me.Text = "Launch"
I've tried Do whiles, Ifs but I haven't got it to reduce the CPU utilization. Any hints or suggestions? Many thanks.
|
|
|
|
|
Hi,
the thread that executes your do-loop will burn CPU cycles at full throttle. So one of your two cores is out of business, waiting for the process to terminate (which gets delayed by the fact that your system is now limping on one core).
The right way to do this is:
- either include a Thread.Sleep(100) or so inside the while loop, so in spins only 10 times per second;
- or better yet, use something smarter, more event-driven; in this case replace the whole do-loop by a simple varProcess.WaitForExit
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
It was so simple I almost didn't believe it.
Thanks for the quick reply. I already modified the code using .WaitForExit and my application is working as expected, without the high CPU utilization.
|
|
|
|
|
You're welcome.
And don't do this ever again! A loop that waits for something to happen should either relinquish the CPU (that's what Sleep does), or perform a blocking call (such as WaitForSomething).
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
I have a class which is supposed to simulate part of a piece of hardware. When the object is created, the constructor is given a reference to the underlying CPU-control object (an object of the class has no meaning without such a base object). The class needs a substantial number of "WithEvents" other objects which need to attach themselves to the underlying CPU control object. For example, "Dim MotorEnable as New IoBit(baseCPU, 4, 6)" will cause any writes to MotorEnable.pin to be visible on bit 6 of port 4 in the base CPU, and will cause any CPU writes to bit 6 of port 4 to trigger a "MotorEnable.PinChanged" event in the hardware-simulation object.
The "Dim XX as New YY(params)" format of declaration is much more appealing than having a separate declaration and initialization. Unfortunately, even though the identity of the new master CPU object is known before all the "Dim XX as New YY()" statements start firing (they fire in response to calling New() with the master object as one of its parameters), as far as I can tell it only exists as a local variable which is not accessible to them.
Is there any clean way to handle such constructs? Possible approaches:
-1- Have the code for the piece of hardware Inherit the base CPU object, and create the new hardware object instead of the base CPU. That would work, but only for the case where there was only one hardware class trying to extend the CPU.
-2- Have the code for the sub-feature objects accept a pointer to an iWillSupplyBase object, which will fire an event that will supply the real base CPU object. If the hardware simulation object implements iWillSupplyBase, it can fire the event within its New() procedure; the sub-feature objects can then attach themselves to the base object at that time.
-3- Use a shared factory method which sets a ThreadStatic reference to the base CPU object and then calls the constructor. The "Dim As New" statements could then pass the ThreadStatic reference to the object constructors. This would probably work fine, but it seems really icky.
-4- Have the simulation object create its own set of port handlers attached to the base CPU, and attach the port pins to those rather than the base CPU. That might be workable, but it seems rather icky, and would add a couple more levels of indirection to all I/O operations.
-5- Give up on the Dim As New syntax, even though it makes much of the code nicer and easier to read.
Is there any other brilliant approach I'm missing?
|
|
|
|