|
on 1. yourForm.BringToFront
on 2. There is the Closing-event for your form (formClosing in vb2005). In that event use e.cancel=true to prevent the form from being closed.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
|
I'm writing an app that uses report viewer to create a detail report.....sorta like a invoice, where it lists the company name and all that they bought and an image of the item they bought. So I created my report and the sub-report for the details section. However when I go to run it I get the company name but the details section grabs all parts for all companies then the break on the next company....then repeats.
Isn't there something else that is better than this? And I cannot believe that there is no one around me that has never used this...how are all these apps getting written that are using some report?
thanks for letting me vent. Any suggestion would be appreciated. And by the way I am passing the key as a parameter from the main report to the sub.
Tom
Tom Wright
tawright915@gmail.com
|
|
|
|
|
|
Dave I was looking into that but I don't know....do I need to install something special on the end users PC in order to get the report to work?
Tom
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Yes, the CR runtime. The higher Visual Studio editions comes with it and the development tools in the ToolBox.
|
|
|
|
|
Tom Wright wrote: However when I go to run it I get the company name but the details section grabs all parts for all companies then the break on the next company....then repeats.
That's because you pulled (or push) all the data. You need to get only the data you want to display and group them correctly.
|
|
|
|
|
The following code throws the error above.
Module Base
Public sub Clock
Do
If needsNewChart = True
Draw = New clsDraw("clock", i_id, True)
thdWorkerSub = New Thread(AddressOf Draw.DoIt)
thdWorkerSub.Name = "Draw"
thdWorkerSub.Start()
thdWorkerSub.Join()
Draw = Nothing
End If
Thread.Sleep(100)
Loop
End Sub
End Module
Public Class clsDraw
Public Sub DoIt
'491 lines of code that creates a new bitMap(theBmp) and draws a stock market "tick chart".
'There are two uses of Monitor.Enter > Monitor.Exit on other objects without difficulties in this code.
Try
lockedGraphics = Monitor.TryEnter(theFrm.bmpTicks, 50)
If lockedGraphics = True Then
theFrm.bmpTicks = theBmp
End If
If lockedGraphics = True Then
Monitor.Exit(theFrm.bmpTicks)
End If
Thread.Sleep(10)
theFrm.pbTicks.Invalidate()
Catch ex As Exception
Ers.Show(c_id & "theTks.Draw.DoIt-setdown2", ex)
End Try
End Sub
End Class
Monitor.Exit(theFrm.bmpTicks) throws the error.
When you step through the code in the debugger, the lock is acquired and the bitmap is copied.
I use Monitor to synchronize my threads in many programs that work together to track the stock market.
I have not encountered this error before.
Why is it occuring?
Thanks.
RCarey
RCarey
|
|
|
|
|
Whoops! Solved the problem.
My code changed the object that I had a lock on. Monitor looses track of which object has the lock. Exit tries to unlock the new bitmap which does not have a lock and then throws the error.
The solution is to create a seperate locking object for monitor to lock, then change the bitmap, and unlock the object. Other procedures use the locking object also.
Works.
Thanks
RCarey
RCarey
|
|
|
|
|
Hello, This is perhaps not the best forum to post this but I've already posted to Microsoft's programming forum but have not recieved a reply.
I have a question about the "wdPropertyTimeLastSaved" property in VBA for word. I have
attached a userform with the following code in the initializing section of my
project. The form is associated with a template that displays the form when
the template is used. Essentially it displays text right on the form itself,
containing the date that the template was last saved. It works great.
However, there is a wrinkle in my design. Whenever, I make changes to either
the template or the form, I am prompted each time I use my template, to save
the template even though I did a save. I found a way around this problem, but
I don't care for the solution. I must go into the VBA editor and run the form
at least once and then save the associated template. That does the trick. No
more prompts to save the template. However, I do not want casual users to
have to go thru this extra work each time a change is made to the template
and/or form.
If you place this small snippet of code below in your own forms, you will
know what I'm talking about. Any suggestions? Thanks.
lblUFdate.Caption is an actual caption on my form which displays the date.
Private Sub UserForm_Initialize()
Dim SavedTime As Date
SavedTime = ThisDocument.BuiltInDocumentProperties( _
wdPropertyTimeLastSaved).Value
lblUFdate.Caption = "Last Updated " & Format(SavedTime, "dd-mmm-yyyy
HH:mm AM/PM")
End Sub
|
|
|
|
|
hi all,
how can i read the serial number(not volume serial number) of hard disk (not disk drive) using vb.net, that will works on any windows version - WinME, Win2K, WinXP etc.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
hi..,
namespace in : Imports System.Management
Public Function GetHardDiskSerial() As String
Dim mobjSearcher As New ManagementObjectSearcher _
("SELECT * FROM Win32_LogicalDisk WHERE Name = 'C:'")
For Each obj As ManagementObject In mobjSearcher.Get
Return obj("VolumeSerialNumber")
Next
Return "00000000000000"
End Function
thanks
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
hi,
Please Read carefully my question. I want to read Hard disk Serial number (not the volume serial number) which is run on all windows operating system.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Hi. I am trying to figure out how to write a select statement that will retrieve all entries that have a certian letter combination in. EG: If the user enters "a" it will retrieve all words starting with an "a". if he enters "ad" it will return all words stsrting with "ad" etc. Please advise
|
|
|
|
|
This is a very basic SQL question. I suggest picking up a beginners book on SQL Server and working through it.
All you have to do is add a WHERE clause using the LIKE operator:
SELECT field1, field2, fieldn, ... FROM table WHERE somefield LIKE 'ab%'
This will return all entries starting with the letters "ab" in some field you chose.
|
|
|
|
|
|
I'm calling a function in an unmanaged DLL. It is returning data as unsigned integers. I am using Marshal.ReadInt32() to marshal the data. I am getting an "Arithmetic overflow" exception when it trys to put the signed integer data into the managed unsigned integer variable:
Dim uiData as UInt32 = Marshal.ReadInt32(ipBuffer)
The exception only happens when the data has the most significant bit set (the "sign" bit). If Marshal.ReadUInt32() existed, obviously I would use that. Since it does not exist, I am marshaling the four bytes individually using Marshal.ReadByte() and constructing the unsigned integer. Is there a better way to do this?
|
|
|
|
|
VFaul wrote: Dim uiData as UInt32 = Marshal.ReadInt32(ipBuffer)
The exception only happens when the data has the most significant bit set (the "sign" bit). If Marshal.ReadUInt32() existed, obviously I would use that. Since it does not exist, I am marshaling the four bytes individually using Marshal.ReadByte() and constructing the unsigned integer. Is there a better way to do this?
No, not really. You're reading a four byte value as signed 32-bit integer (31 bits plus the sing bit), which means the number read can be a negative number, not positive. When the conversion to Unsigned is attempted, it can't convert a negative number, so you get the exception.
You can convert any number of bytes using the BitConverter class. You still need to read the four bytes into an array, but you can use the BitConverter.ToUInt32[^] method to do this, probably easier than you're doing it now.
|
|
|
|
|
Yes, I understand why the exception is occurring.
What baffles me is that there aren't unsigned marshaling methods: Marshal.ReadUInt16(), ReadUIn32(), and ReadUInt64()!? I'm being forced to do four ReadByte() calls when one call to ReadUInt32() is all I would need.
|
|
|
|
|
VFaul wrote: What baffles me is that there aren't unsigned marshaling methods: Marshal.ReadUInt16(), ReadUIn32(), and ReadUInt64()!? I'm being forced to do four ReadByte() calls when one call to ReadUInt32() is all I would need.
Yep. After looking at the code for the Marshal class, ReadInt32 method, it's sort of obvious why. That method has but a single line of code that calls a function, ND_RI4 , exported by mscoree.dll . This function reads a 4 byte value and returns an I4, or Int32. The only other exported functions that do this are:
ND_RI2 - Returns a 16-bit signed integer
ND_RI4 - Returns a 32-bit signed integer
ND_RI8 - Returns a 64-bit signed integer
and
ND_RU1 - Returns a single byte
There are counterpart functions that write values too, modeled after these "read" version. Sadly, it boils down to the CLR doesn't natively support what you want to do.
I also looked into the possibility of using Marshal.ReadIntPtr, which returns a processor width pointer. On any non-x64 version of Windows, this always maps to a 32-bit unsigned integer. But, there is no conversion supplied to go from an IntPtr to a UInt, only a conversion to Int32 exists.
|
|
|
|
|
Hi All,
I am doing Installaion build for a Vb Based Application.In the automation procedure of this,I need to change the version Compatability(In Project\Project Properties\Component) from outside.Means I need to change it programmatically.
Means in the automation procedural steps,it will take the project automatically,change the compatability and then save the project.
Can Anyone help me to solve this problem.......
Thanks In Advance,
Jeeva.
|
|
|
|
|
I am writing a VB 6 program that shd run on the network. A user has to login before using the program. Now, I want to prevent multiple user login using one user account. It shdn't allow or prevent a user to login whilst his/her account is in use. I am using MS SQL Server 2000 Database.
Please, can anyone help me with this? I would be very grateful if you could help me with this.
|
|
|
|
|
Once the user is logged in you can mark him/her as logged-in in your database. Whenever the user tries to log in you can check against the database if he is already logged-in or not.
"Legacy code" often differs from its suggested alternative by actually working and scaling.
—Bjarne Stroustrup
|
|
|
|
|
Hi. How do I change the title bar heading in a form dynamically in code?
|
|
|
|
|
use below statement in the code
form1.text=" Title Here!"
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|