|
Create a new instance of a class passing parameters.
Create a new thread pointed at the sub in that class that does the work.
Name and start the thread. If you want you can wait till the thread finishes(Join) and then dispose of the instance of the class.
Here is a code snippet.
SQL.B.setDay = New SQL.clsSetUpAnyDay(Now.Date) 'new class
thdWorker = New Thread(AddressOf SQL.B.setDay.DoIt)'new thread
thdWorker.Name = "setDay" 'name it
thdWorker.Start() 'start
thdWorker.Join 'wait till it finishes
SQL.B.setDay = Nothing 'dispose
Hope that helps.
RCarey
RCarey
|
|
|
|
|
I have a Crystal report and a CrystalReportviewer and i want to put a button to open pagesetup for this report.In the CrystalReportViewer toolbar i see only a print , zoom and some other buttons but no Pagesetup.
Any idea
Thanks.
|
|
|
|
|
hey guy
if u click on print button at cr report it will automatically display the pagesetup or print option
if u want to seprate add a button then write code
crrptview.printreport=true
hope u understand
lucky
|
|
|
|
|
Hi,
I'm trying for days now to figure out how to implement "Volume Shadow Copy Service" (VSS) under vb.net.
The goal is to get a tiny application the runs at XP, Vista and 2003 to make backups of files in use (locked).
I read almost the complete Internet and Google-Cache but didn't find any helpful startup-point. The "Volume Shadow Copy Service SDK 7.2" is C++ only, what's definitly not my language
Documentation can be found at: http://msdn2.microsoft.com/en-us/library/aa384961.aspx[]
Anybody out there that can give me a hint
Regards,
wtfia2k
|
|
|
|
|
Interesting.
Well, the documentation was written for a target audience of C++ developers, but that hardly makes the SDK "C++ only".
Though I can't find any VB.NET, or any other language, code samples, it's possible to use the VSS from VB.NET. Start by adding a COM Reference, in your VB.NET project, to the Volume Shadow Copy Service, then open the Object Browser and look through the Interop.VSS item listed in the browser.
You are venturing into uncharted waters here. You probably will not find any articles, samples, or knowledgable help on using VSS from your app.
|
|
|
|
|
Dave Kreskowiak wrote: Interesting.
glad to here
Dave Kreskowiak wrote: Though I can't find any VB.NET, or any other language, code samples, it's possible to use the VSS from VB.NET. Start by adding a COM Reference, in your VB.NET project, to the Volume Shadow Copy Service, then open the Object Browser and look through the Interop.VSS item listed in the browser.
that's exactly what I did - so far so good.
Thanks for acknowledging me.
Dave Kreskowiak wrote: You are venturing into uncharted waters here. You probably will not find any articles, samples, or knowledgable help on using VSS from your app
I feared that unfortunately in such a way.
Regards,
wtfia2k
|
|
|
|
|
Thanks again to Dave Kreskowiak who confirmed my idea to use the com-object "Volume Shadow Copy Service 1.0 Type Library".
After fooling around a bit with it I'm that far, that I really make Shadow Copies
Here is the code how I've done it (in a quick and dirty manner, of course )
Dim vshadow As New VSS.VSSCoordinator<br />
Dim snapshotSetID As System.Guid<br />
Dim _snapshotID As System.Guid<br />
<br />
vshadow.StartSnapshotSet(snapshotSetID)<br />
vshadow.AddToSnapshotSet(root, System.Guid.Empty, _snapshotID)<br />
<br />
Dim vssAsync As VSS.IVssAsync = Nothing<br />
Dim callback As Object = Nothing<br />
<br />
Debug.Write("starting shadow copy .")<br />
vshadow.DoSnapshotSet(callback, vssAsync)<br />
While True<br />
Dim hr As Long<br />
vssAsync.QueryStatus(hr, 0)<br />
Debug.Write(".")<br />
If DirectCast(hr, IVssAsyncQueryStatus) = IVssAsyncQueryStatus.VSS_S_ASYNC_FINISHED Then<br />
Exit While<br />
End If<br />
Thread.Sleep(1000)<br />
End While<br />
Debug.Write(" done!")<br />
Debug.WriteLine("")<br />
<br />
Debug.WriteLine("examine snapshot")<br />
Dim snapshotProps As VSS._VSS_SNAPSHOT_PROP = Nothing<br />
vshadow.GetSnapshotProperties(_snapshotID, snapshotProps)<br />
<br />
Dim _snapshotDeviceName As String = snapshotProps.m_pwszSnapshotDeviceObject<br />
Debug.WriteLine("Shadow copy device name: " & _snapshotDeviceName)
So far - so good! But how to access the shadow copy to extract files out of it?
Trying someting like this:
Dim ShadowedRoot As String = Nothing<br />
vshadow.ExposeSnapshot(_snapshotID, Nothing, 1048576, "C:\ShdwOfC", ShadowedRoot)<br />
'vshadow.ExposeSnapshot(_snapshotID, Nothing, _VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY, "c:\ShdwOfC", ShadowedRoot)<br />
Debug.WriteLine("ShadowedRoot: " & ShadowedRoot)
crashes with an NotImplementedException.
What the he.. !!! Does this really mean, it's not implemented in the com yet, or am I doing something completely wrong? (a lot of wood, but now trees ...)
Regards,
wtfia2k
|
|
|
|
|
Well, either the COM interface hasn't been impemented or the parameters are wrong (which it doesn't look like they are), or certain functionality hasn't been fully implemented depending on the values of certain parameters.
I would recommend trying to expose the snapshot as a share on the server to see if that works. If it also fails, then I would have to believe that ExposeSnapshot hasn't been implemented through COM yet.
|
|
|
|
|
I have some DataGridViewComboBoxColumn s in my datagridview. I have all of the code working correctly but I would like to find a way to have the CellValueChanged event fire when the new value is selected in the comboboxcolumn and not after a value is selected AND I click outside of that cell to commit it.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
The Cell value won't change until the cell loses focus. Until then, you're still editing it.
The Cell's value doesn't pickup the value of the ComboBox until focus is lost. This is when the SetValue method of the DataGridViewComboBoxCell is finally called, which sets the value of the DataGridViewCell, which fires the CellValueChanged event. The DataGridViewCombBoxCell doesn't expose any events itself, so I don't know how you're going to know when the ComboBox value changes.
|
|
|
|
|
Hi ol
My name is yasin
i am currently developing an application in vbnet 2003
the requirements are as follows:
On the form will be located a number of points (no more than 4) through a light ray must pass. The light ray emerges in a specific direction from a fixed point.
Pls note the light ray is to be represented by a line
The light is deflected by reflection using a suitable number of plane mirrors.
Note that for a plane mirror the angle of reflection and the angle of incidence are equal.
The simulated system must allow the user to place simulated mirrors in the enclosed area to reflect the light ray to follow a path that will make the light ray illuminate all the designated fixed points.
this means dynamically placing lines (simulated mirrors) with mouse operations in the path of the simulated light beam; another line.
As soon as a mirror is placed then the light beam will be reflected and thus change course. Clearly the first attempt of placing the mirror is unlikely to direct the beam exactly as required so is essential that the mirror can be rotated about the point where the beam hits until the desired effect is achieved.
Once the simulation is showing the light beam passing through all the designated points then the system will report on the exact location and orientation of the mirrors.
At the moment i have managed through some research to create a label which can be moved around the form at runtime. the label will repersent the mirror. I even have the four fixed points and the source of the light ray on the form. By instantiating a class called clsBeam i can even draw the lines which will represent the the beam
Any ideas or even code on how to deflect the line (light ray) and how to rotate the label about the middle point will be highly appreciated.
Thanking you in advance.
Regards
|
|
|
|
|
Sounds like an interesting piece of homework. The deflection of the light, to do it correctly, would involve reading up on some physics. As for the rest, you should ask specific questions as you get stuck, rather than ask us to provide code for you.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yasin786 wrote: Any ideas or even code on how to deflect the line (light ray)
This is simple Trigonometry, vector math. Open your math book from school.
Yasin786 wrote: how to rotate the label about the middle point will be highly appreciated
A don't think a label control is a good starting point for this control. You're going to need to move as well as rotate to any angle, so you're going to have to come up with a custom control for this.
You start by reading up on creating selectable and moveable graphics images here[^].
Or, if that's too much to go through, you can search for a graphics library that gives you this ability.
|
|
|
|
|
Sounds like you are working in 2D and not 3D.
So it is a basic geometry exercise.
Once you have worked out how to design the geometry you may be more successful with getting help on the VB side.
I would suggest that you cut out pieces of paper, simulating the exercise, and work out the geometry then start mapping this to VB.
Good luck;)
You always pass failure on the way to success.
|
|
|
|
|
Why would you need a Label?
If you want to draw a couple of lines, you can do that directly on a Form, or (and I prefer)
on a Panel. You can use different colors, line thicknesses, whatever to indicate rays,
mirrors, points, ...
So it all boils down to a couple of sine and cosine evaluations.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
I have a VB server application (driven from a set of ASP classic pages). To improve throughput of the VB app we have written a small component in c++ that runs multiple instances of the server app, and when it receives the requests from the ASP page it redirects them to which ever instance is free.
We've always been careful to maintain the base addresses of all our .dlls & .exes so they don't clash with each other, but my question is, that if I am running multiple instances of the VB .exe will it clash with itself and get rebased in memory and is there any way to prevent this? Or, will the .exe only be loaded once into memory and all instances access the same memory locations? And what about .dlls used by the .exe, will each only be loaded once, or per instance of the .exe?
Also, are there any good tools (preferably free) that I can use to look at what's actually happening when the exe/dlls get loaded?
Any advice would be really appreciated.
Simon
|
|
|
|
|
Simon Stevens wrote: running multiple instances of the VB .exe will it clash with itself and get rebased in memory and is there any way to prevent this?
It's handled automatically. Even though making sure your base addresses don't stomp each other is kind of important, it's not necessary in most cases. Most DLL's don't need to be loaded at a specific address.
The default base address for .EXE's is 0x400000, DLL's is 0x100000000, IIRC.
If an EXE or DLL absolutely has to be loaded at a specific address (which is rarely ever required) and that space isn't available, it's just not loaded. If it can be loaded anywhere (the default Link configuration), and the base address isn't available, it'll be rebased automatically.
Though, there are performance benefits to specifying your own default base addresses. If there is a collision, the DLL that is being loaded is moved to a free block in the address space. Moving code around is an expensive operation. So if a DLL gets used by multiple processes, the base address that's good for one process might not be so good for another!
As for loading multiple copies of your .EXE. Since each process gets it's own virtual address space (about 4GB worth), it thinks it is the only process loaded in Windows. So even though you have lots of processes running, each one thinks it's the only process running.
When the .EXE is launched, it's loaded, by default, at 0x400000. Launch another .EXE and it gets loaded at the same address, but in another virtual address space. If you launch the same .EXE again, it also gets it's own virtual address space, but another copy of the code is NOT loaded. The code for each process is mapped into each virtual address space, as needed. So, if you launch 16 copies of Notepad, only one copy of the code stays in memory and that code gets mapped into the virtual address space of each process.
The same is also true for DLL's.
This "mapping" is why you can load the same .EXE or .DLL multiple times, but only keep a single copy of the code in memory. Though, say you have a .DLL being used by two different process and each has to load the .DLL at a different address?? Easy. Each address space maintains its own map of code in the .DLL. Each map does any rebasing of the code required to get it to fit where the address space allows.
You can read more about it here[^].
|
|
|
|
|
Cheers Dave, that clears things up a bit. I hadn't realised that each .exe was getting it's own address space, that does make more sense now I think about it.
So all I need to worry about is my .dll's clashing with other .dll's that are loaded by my .exe into it's own virtual address space.
Brilliant, Cheers.
Simon
|
|
|
|
|
Not really. Any rebasing happens automagically. The biggest performance hit is going to come when the DLL is loaded for the first time. After that, where the DLL lands in the address space is usually where it stays for the lifetime of the process its loaded into.
|
|
|
|
|
Right, so for example, I've got a.exe which loads b.dll, c.dll. For optimum performance, I just need to change the base addresses of b.dll and c.dll so they don't clash with each other, which will prevent any rebasing and any performance loss.
Simon
|
|
|
|
|
|
Thank you.
Simon
|
|
|
|
|
Class Class1<br />
Public Field1 as Integer<br />
End Class
I'm sure that many coders want browse Class1.Field1 in designer property grid , why Microsoft doesn't support it ?
|
|
|
|
|
I think the clue is in the word "Property"
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Ky Nam wrote: I'm sure that many coders want browse Class1.Field1 in designer property grid
Speak for yourself. I don't want it to.
Ky Nam wrote: why Microsoft doesn't support it ?
Because exposing fields as public is bad practice...? You're supposed to be exposing PRIVATE fields through nice little public Property accessors.
|
|
|
|
|