|
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef hpDest As any, ByVal hpSource As any, ByVal nBytes As integer)
I am converted the vb code into vb.net in this the copy memory function does not work it seems.
I am calling the function in the form
Call CopyMemory(arrBarCodeInformation(0), ptrBarCodeInfo, size_Renamed)
but is showing some error .How to use the copy memory in vb,net here arrBarCodeInformation(0) is an structure value.slove the above problem and also give me the code for the same.
pls help me to slove the problem..
|
|
|
|
|
|
I have tryied but i need to copy the integer value into the structure variable .how can i do that.pls give me the code .its very difficult for me to convert.pls help me its very urgent....
|
|
|
|
|
I love how many people post 'it's very urgent' but don't give anything resembling the info that people need to help.
sundar_mca wrote: i need to copy the integer value into the structure variable
Assuming that you have a block of memory that represents the struct, you can presumably use marshalling to copy the block of memory across. Or, you can cast that memory location to BE the struct, and copy them manually.
sundar_mca wrote: .pls give me the code
That you would even ask this, based on the info you've provided ( nearly none ), tells me that you're in over your head. Try posting the information that describes the problem, then perhaps we can help.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
sorry for sending such messages.i hav etryied the marshaling function muct i want to copy the integer value to structure how can i do it using marshal function
|
|
|
|
|
If all you're doing is marshalling a structure back and forth to unmanaged code, you DO NOT NEED the CopyMemory function. Post more of this code that your trying to translate so we can help. If you don't, there's nothing we can do to help!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Why does the Return statement of a VB function return a 0 or -1 when we assign a value to the variable being returned?
For eg:
Module Module1
Sub Main()
Dim i As Integer = 3
i = square(i)
Console.WriteLine(i)
Console.Read()
End Sub
Private Function square(ByVal i As Integer) As Integer
i = 6
Return i = 6
End Function
End Module
O/P: -1
|
|
|
|
|
You are not assigning a value to i. Rather you are comparing if i = 6 which is a boolean value that the system is converting to an int.
Turn option strict to on in the the application properties (compile tab) and you will get a compiler error telling you implicit conversion from Boolean to Integer is not allowed.
Mike Lasseter
|
|
|
|
|
You re right. Thankyou Lasseter
|
|
|
|
|
I'm trying to search my hard drive for all of my .mp3 files. If anyone could help me and guide me with some sample code i would greatly appreciate it. Thanks.
CALVIN Muller
|
|
|
|
|
You'll need a recursive function to traverse through all the directories. Actually getting mp3 files in the directory is easy.
IO.Directory.GetFiles("c:\songs", "*.mp3") This will return a string array of each mp3 file located DIRECTLY under the directory c:\songs. In other words it won't find files in any subdirectories. To do that you would create a method that takes a path as a paramater. The method would get all the .mp3 files under the path and then loop through all the subdirectories. For each directory it finds it will call itself passing in the directory to search. io.Directory.GetDirectories(path) will return all the directories under the given path. I'm sure you can find examples using google to traverse a directory tree.
|
|
|
|
|
Thank you very much. Greatly appreciated
CALVIN Muller
|
|
|
|
|
Hey there, i am looking for a way to be able to filter a ListView with a TextBox where i can insert a few characters, say "CA" and ii will filter the ListView across multiple columns. eg. If i have a ListView with Artist and Title. i want to type in "Hello" and it will display whatever matches that Pattern in the "Artist" column and "Title" column.
If anyone could help i'd appreciate it. Thanks.
CALVIN Muller
|
|
|
|
|
The ListView can't turn on and off the visibility of individual items, so you have two choices:
1) (Harder, but more useful) Implement your own version of the ListView and ListViewItem classes to provide this ability. It will require you to ownerdraw each ListViewItem when called upon.
2) (Easier, but slower) Dump the contents of the ListView and repopulate it with filtered values from your data store each time the filter textbox changes.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How to create aspx pages with top part of the page constant accross multiple pages. Is there anything like frames in vb.net or any other way of implementing this. I have some drop down lists and a button control, on top of multiple pages. Selection of the drop down list values and button click event should trigger a resulting page in the bottom part. Appreciate all the help
Raj D
|
|
|
|
|
There is nothing about web pages in VB.NET. You're talking about ASP.NET, which is a framework for web-based applications. VB.NET is a language used to write applications using that framework.
And yes, there are ways of doing what you want. Ask your question in the ASP.NET forum for more details.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am trying to insert some date columns into a MySQL database using vb.net. MySQL has a date format like YYYY-MM-DD. I am inserting text files and the date columns are formatted like MM/DD/YYYY. Is there any way to format the date using vb.net so I can insert the files?
jds1207
|
|
|
|
|
Did you try to insert data as it is (MM/DD/YYYY)? I've noticed that SQL Server does the same thing. Some time ago I created parser to get customers info from flat file and didn't have to change anything. Try it first if it doesn't work you can use Format function of String class to convert your date.
Make sure your date first converted to String. You can do this by using Date.ToShortDateString().
Alex.
|
|
|
|
|
Here's the code that will help you to convert your date to String. This is just example of todays date to format you need (YYYY-MM-dd). So all you need is to get your dates and change them to this format by using ToSting function I'm giving you.
Dim MyDate As New DateTime<br />
MyDate.Now.ToString("yyyy-MM-dd")
Good luck.
Alex.
|
|
|
|
|
The problem is that he needs to return it as a Date datatype but wants it to be in that "yyyy-MM-dd" format which is a string format according to VB.NET.
Cleako
|
|
|
|
|
As far as I know Date is a sting just different format. I know that any string that represents date will go into the database with out any problem.
|
|
|
|
|
Ohhh, for some reason I was thinking XML.
Cleako
|
|
|
|
|
Is this code correct because I keep gettting the error:
Incorrect date value: '02/07/2006' for column 'OrderDate' at row 1
Here is code:
Dim dtTable As New DataTable
Dim row As DataRow
Dim formatdate As New DateTime
For Each row In dtTable.Rows
If row("datereceived").ToString() = formatdate.ToString("MM/DD/YYYY") Then
formatdate.ToString("YYYY-MM-DD")
ElseIf row("backorderdate").ToString() = formatdate.ToString("MM/DD/YYYY") Then
formatdate.ToString("YYYY-MM-DD")
ElseIf row("datecanceled").ToString() = formatdate.ToString("MM/DD/YYYY") Then
formatdate.ToString("YYYY-MM-DD")
ElseIf row("orderdate").ToString() = formatdate.ToString("MM/DD/YYYY") Then
formatdate.ToString("YYYY-MM-DD")
End If
Next row
|
|
|
|
|
Try this.
Dim dtTable As New DataTable<br />
Dim row As DataRow<br />
Dim formatdate As New DateTime<br />
<br />
<br />
For Each row In dtTable.Rows<br />
If row("datereceived").ToString() = formatdate.ToString("MM/DD/YYYY") Then<br />
formatdate.ToString("yyyy-MM-dd")<br />
ElseIf row("backorderdate").ToString() = formatdate.ToString("MM/DD/YYYY") Then<br />
formatdate.ToString("yyyy-MM-dd")<br />
ElseIf row("datecanceled").ToString() = formatdate.ToString("MM/DD/YYYY") Then<br />
formatdate.ToString("yyyy-MM-dd")<br />
ElseIf row("orderdate").ToString() = formatdate.ToString("MM/DD/YYYY") Then<br />
formatdate.ToString("yyyy-MM-dd")<br />
End If<br />
Next row
|
|
|
|
|
First, the Date/Time in any SQL database doesn't have a format. The format only applies when the data is displayed, not when it's stored.
If you database and code is setup properly, you don't have to worry about the format at all. Using a parameterized query, the parameter objects worry about the conversion for you. All you have to do is pass in a DateTime object into the parameters Value property.
You can read up on parameterized queries here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|