|
Thanks man!! Your suggestion worked!! Thanx a Lot!! Code Project Rulez!!
Devraj Raut!!!
|
|
|
|
|
I'm glad I could help.
And welcome to CodeProject.
|
|
|
|
|
Hi Guys!! Its me again. Does anybody know how to add a Progress Bar to a ListView's ListViewItem. I want to display the Download Percentage of each Task in a ListViewItem in a Progress bar. Does anybody have any suggestions or Links i can use which can help me. Plz reply back if you Guys knowanything. Thanx a Lot. Im much Obliged.
Guys, Im having much more doubts, but i just dont want to stuff all Questions, in One Query, coz they are different from each other. PLz help me if u can. Thanx!! I have 4 to 5 Questions in all. Plz check them out if u wanna help. Thanx!!
Devraj Raut!!!
|
|
|
|
|
|
Hi Guys!! I'm Devraj and i have almost completed my Project (DevNik: A Bit Torrent Client) in VB.NET 2005
I'm in need of a Vb.NET ActiveX Control which i could use to display the Download and Upload Rate in my Client. Has anybody heard or know about such a control which will be helpful to me. I need something like the TaskManager in WinXP, just that it must have 2 lines, one for Download rate and the other for Upload rate.
If anybody knows of such a control , plz could you send me a link or give me some idea where i might get it. I'm also welcome to any alternatives or suggestions. Thanx in Advance . Reply Back to me.
Devraj Raut!!!
|
|
|
|
|
Visual Studio comes with a free MSChart.ocx (ActiveX). However, I recommend that you steer clear of ActiveX controls in .NET. COM interop is slow and COM/ActiveX objects are very prone to DLL hell.
Instead, I recommend that you use a .NET graph control. Such as the ZedGraph[^] control which is free and way better than MSChart.
|
|
|
|
|
Hi All,
I am using datagridview control to display data in the datagrit. Datagridview is bound to a data source, nothing very complex. I want to insert data as I tab out of a new row( and data entered into that new row) and come to the next row. It should do it automatically.
Can any one please give me any ideas at to how I could do that?
Thanks a lot!!
|
|
|
|
|
Hi Everyone,
In VB.NET application, I want to copy a structure into a 2 dimensional array using CopyMemory.
just for your idea giving you the structure defination.
'for storing the pixel arrays...
_
Private Structure SAFEARRAYBOUND
Dim cElements As Integer
Dim lLbound As Integer
End Structure
_
Private Structure SAFEARRAY2D
Dim cDims As Short
Dim fFeatures As Short
Dim cbElements As Integer
Dim cLocks As Integer
Dim pvData As Integer
Dim Bounds() As SAFEARRAYBOUND
End Structure
I have gone through many forums but couldnt able to find the appropriate answer.
Expecting a solution soon.
Thanks
Chirag...
|
|
|
|
|
|
Hey thanks for you response. But I have tried that way too. but couldnt get success. Is there any other alternative......????
Chirag...
|
|
|
|
|
By default, the compiler will "optimize" your structure by re-ordering its fields. Because of this, you'll need to define that your structure's fields be layed out sequentially in memory. You can do this via the StructLayout attribute as follows.
<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _
Public Structure SAFEARRAYBOUND
Dim cElements As Integer
Dim lLbound As Integer
End Structure
I've found an article on this website explaining how to do a CopyMemory call in VB.NET. It also goes over .NET marshalling too. Perhaps this will help you?
http://www.codeproject.com/vb/net/netcopymemorysample.asp[^]
|
|
|
|
|
that too i have done and also gone through the article.....but major problem is that i could not be able to convert this sequential structure into 2 dimensional array.......basically i need to covert this structure into 2 dimensional array which gives pixel information......and later on i will convert it into one dimensional long array.....thats wht my purpose....
Chirag...
|
|
|
|
|
How is your 2 dimensional array defined?
How will it be used?
|
|
|
|
|
Public Function LongPixels() As Long()
'_____________________________________________________
'
' Purpose: converts the 2-dimensional 3/4 Byte DIB into a one-
' dimensional Long array, for easy summing of long int values.
' scans from left to right, then bottom to top.
' diblongarray(0) = lower left pixel.
' diblongarray(ubound) = upper right pixel.
' Assumptions: the DIB is 24-bit, the byte order of the pixels is
' r-g-b (not the common b-g-r)
' Affects:
' Inputs:
' Returns:
'_____________________________________________________
Dim bDibMag() As Byte '2 dimensional byte array holds pixels by row,col
Dim lX As Long, lY As Long 'x = pixel col, y = pixel row
Dim saDibMag As SAFEARRAY2D
Dim lXEnd As Long
Dim l As Long
Dim lCol As Long
On Error GoTo Cleanup
'structure the 2-dimensional safearray
With saDibMag
.cbElements = 1 'bytes to an element
.cDims = 2 'dimensions
.Bounds(0).lLbound = 0 'lbound of 1st dim
.Bounds(0).cElements = Height '# rows = height in pixels
.Bounds(1).lLbound = 0 'lbound of 2nd dim
.Bounds(1).cElements = LineByteWidth() 'calculate width with 24/32 row pad
.pvData = lPtrDibMag 'pointer to the DIBits
End With
'HH: MoveMemory is not available in Windows API but in Win32 API, similar command in current API is CopyMemory
'for MoveMemory, it's definition: Sub MoveMemory(pDest As Any, pSource As Any, ByteLen As Long)
'it moves a block of memory from one location to another.
'VarPtr: retrieves the memory handle of an object.
'ATTN: while calling using ByVal, it transfer the the source's memory handle
'if calling byRef(default), it instead transfer the tempoary variable that stores the souce's memory handle
'in a simple way, the following command is a quicker way, if there's a bunch of data, to pass values
'of source variable to destination variable
MoveMemory ByVal VarPtrArray(bDibMag()), VarPtr(saDibMag), 4 'copy safe array to bDibMag
lXEnd = (Width - 1) * 3
l = 0
ReDim lColor(Width * Height - 1) '4 MB
'HH: FOLLWING LOOP READS TWO DIMENSIONAL VALUE AND STORE THEM INTO A ONE-DIMENSION LONG ARRAY
'HH: READS VALUE FROM BOTTOM TO TOP
For lY = 0 To biDibMag.bmiHeader.biHeight - 1
DoEvents
'HH: FOR EACH ROW, READS VALUE FROM LEFT TO RIGHT
For lX = 0 To lXEnd Step 3
MoveMemory lCol, bDibMag(lX, lY), 3
lColor(l) = lCol
lCol = 0
MoveMemory ByVal VarPtr(lCol), 0&, 3
l = l + 1
Next lX
Next lY
LongPixels = lColor
lPix = l 'store pixelcount
'zero out the moved memory, so as to avoid
'a pacman-like memory-use situation
MoveMemory ByVal VarPtrArray(bDibMag), 0&, 4
Cleanup:
Erase saDibMag.Bounds
Erase lColor
Erase bDibMag
If err.Number <> 0 Then WriteLog "MAGRAS ERROR In Procedure LongPixels, #" _
& err.Number & ": " & err.Description
err.Clear
End Function
this is the VB function which i need to convert to VB.NET...this is the way i have defined the two dimensional array in VB.NET project..
Dim bDibMag(,) As Long '2 dimensional byte array holds pixels by row,col
Thanks again for taking interest in this problem..
Chirag...
chirag.danech@gmail.com
|
|
|
|
|
After looking at your code, the only reason MoveMemory() is called is for performance reasons. Maybe in VB6 this was faster, but in VB.NET I doubt it. The reason is because a call to MoveMemory() is a call to unmanaged code, requiring a P/Invoke, which is a performance hit in .NET. I suggest that you make it easy on yourself, remove all of the MoveMemory() calls, and just iterate through the 2d array and directly copy the color values into your 1d array. You can look into boosting performance after you get it working.
Also, there appears to be a lot of legacy VB6 calls in your VB.NET code. You may just want to rewrite the whole thing.
You should replace your "On Error Goto" with Try/Catch.
You should replace "DoEvents" with "Application.DoEvents()".
Do a "Return lColors" instead of "LongPixels = lColors", and perhaps return an empty array on error.
|
|
|
|
|
Yeah I totally agree with you. Eventhough I have started to thinking to discard all the MoveMemory call. But as you have told just iterate through the 2d array and directly copy the color values into 1stD array. Yeah so for that the question is that..How can i get the 2D array from the structure. I mean once I get the 2D array I can easily convert it into the 1D array.
And Yeah whatever changes you have mentioned I have already made on my new .NET Code.
I appriciate If you can solve this too.
Thanks
chirag.danech@gmail.com
Chirag...
|
|
|
|
|
This is definitely tricky.
My guess is that pointer "lPtrDibMag" points to a BITMAPINFO[^] structure. This structure is defined like this...
typedef struct tagBITMAPINFO {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;
The second field has the array of colors you need. The trick is accessing this info with pointer "lPtrDibMag". I believe you can access it like this.
Dim pbmi As BITMAPINFO<br />
pbmi = CType(Marshal.PtrToStructure(lPtrDibMag, GetType(BITMAPINFO)), BITMAPINFO)
I also found this[^] post in the C# forums which could help.
-- modified at 18:13 Sunday 9th April, 2006
|
|
|
|
|
As we all know, creating a printdocument can be murder in VB.NET... however i've come to understand it.
Most of the simple reports and letters I can write the programming for with no problem. My company is now asking me if it is possible to add a collection of PDF files to the program in order to create templates for some of these reports, and have the program fill in a few fields where necessary.
How do I load a PDF into a printdocument? The research I've done so far is leading me down the path of looping though the PDF converting each page into an image while looping throught the printdocument and setting each page to that image... Any sample code would be appreciated. From there I can figure out the rest.
Thanks,
Andrew
|
|
|
|
|
Hello,
I created a windows service in VS 2005 and installer exactly according to the instructions Here
However, the service does not appear in my list of services. Has anyone ran into this? Is there a way I can start the service w/o seeing it in the list? Command line, etc?
Thanks!
"Half this game is ninety percent mental."
- Yogi Berra
If you can read thank a teacher, if you can read in English, thank a Marine.
|
|
|
|
|
Try checking the registry HKLM\SYSTEM\CurrentControlSet\Services to see if it is listed, this is where all the registered services are listed
Did you have the services mmc open when installing, this can stop it working
you can start services using - net start SERVICENAME at the command line
"If i was king cigarettes would be free."
|
|
|
|
|
|
Hi all,
I am creating a password login form but everytime I run the program, the first form that is loaded is not the login form but rather another form.
How can I firstly load the login form and wait for the correct password before I load any other form?
Thank you very much.
|
|
|
|
|
If this is VB.NEt select the PROJECT in the SOLUTION explorer and select properties.
Change the startup object in here to the form you require.
You then check the password and do
Dim oFrm as new form1
oFrm.Show
me.hide
If this is VB6 select the PROJECT in the PROJECT explorer and select properties.
Change the startup object in here to the form you require.
You then check the password and call
form1.Show
Unload me
"If i was king cigarettes would be free."
|
|
|
|
|
|
Hi guyz.Can someone pliz give me a clue on how i can convert a report int a PDF file and save it in VB 6.0.I'm kindah stuck with my project and it's really getting on my nerves
Also I have have a form that one is supposed to fill in some data then
on a click of a button a report is created reflecting what is on the form currently,i.e the program should create reports at runtime
I tried the usual way by using data environment connecting to data reports but that only creates reports based on the data on the database(old data)and not the current data (data on the form when at runtime)
Your responsibility determines your authority which in turn specifies your teritory
|
|
|
|