|
I'm not sure what default serialisation code exists, but you probably need to write code to save the data in your class, and to reload it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i need a sample code in vb.net to write/read a barcode?
|
|
|
|
|
Google is your friend and the code you write will depend HEAVILY on the barcode scanner your using. There is no "generic" code that works with every barcode scanner out there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When I make a query in sql server 2005 like "SELECT something FROM somewhere", there is a way to know the number of selected rows without the need of other query "SELECT COUNT(*) FROM somewhere" ?
Thanks
|
|
|
|
|
This is returned automatically unless the SELECT statement is preceded by a SELECT NOCOUNT ON statement. This is not applicable to Access databases though. Jet doesn't support returning the "number of rows affected".
What is it your're trying to do. So far, this question has nothing to do with VB.NET...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to redim an array to the number of rows selected, and fill this array from one of the columns of the query.
|
|
|
|
|
Then you're looking in the wrong place. Fill your DataSet, DataTable, or whatver your using to store the results of the query. Then use the count of the number of Rows in the collection to set your array dimensions.
Dim ds As DataSet
' code to fill DataSet with a couple of tables...
Dim arraySize As Integer
arraySize = ds.Tables("whatever").Rows.Count
Dim myArray(arraySize) As String
.
.
.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, you are right. I was working with a not too good method. With a dataset it's better implemented.
Thanks a lot.
|
|
|
|
|
No problem!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How can i see the content of a sql database in a datagrid in a SmartDeviceApplication made in vb.net 2005?
I am developing a pocket pc se 2003 application and i cannot get to bind the sql data base with the datagrid in the pocketpc emulator
if anyone could help me... Thanks a lot
Mario
|
|
|
|
|
I want to get the windows system message WM_PASTE in my form,I use
If PeekMessage(wMsg, Me.Handle.ToInt32, WM_PASTE, WM_PASTE, <br />
<br />
PM_NOREMOVE) <> 0 Then<br />
...<br />
end if
But i cann't receive the WM_PASTE message when i paste one file from one folder to another.i changed "Me.Handle.ToInt32" to "vbnull",it failed,too.
i read msdn,know that this method can only receive message in current thread,then how can i get the message of the system?
-- modified at 10:37 Saturday 21st January, 2006
|
|
|
|
|
Are you saying that your trying to intercept the WM_PASTE message system wide? No matter what application the message is sent to?
You can't do it using PeekMessage. It'll only return messages that were sent to your application. The only way to get system-wide notification of messages is to implement a system-wide WH_GetMessage hook procedure. Any application that calls PeekMessage or GetMessage will force windows to send the message to your hook procedure first, you do whatever you want with it, then the message is sent to the application that called PeekMessage or GetMessage.
This is not for the faint of heart! Your hook procedure code must be tight...really tight! This is because your code is going to get called A LOT and any bottle neck in your hook proc code is going to slow down the entire system!
You can find out more by Googling for VB.NET WH_GetMessage[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i write a Module as follows
<br />
Imports System.Runtime.InteropServices<br />
Module modGetWinMsg<br />
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Integer, ByVal lpfn As GetWinMsgDelete, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer<br />
<br />
Private Declare Function CallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Integer, ByVal ncode As Integer, ByVal wParam As Integer, ByVal lParam As MSG) As Integer<br />
<br />
Private Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Integer) As Integer<br />
<br />
Private Const WH_GETMESSAGE As Integer = 3<br />
<br />
Private Const WM_PASTE As Integer = &H302<br />
<br />
Dim hRet As Integer<br />
<br />
Private Structure MSG<br />
Private hwnd As Integer<br />
Private message As Integer<br />
Private wParam As Integer<br />
Private lParam As Integer<br />
Private time As Integer<br />
Private pt As POINTAPI<br />
End Structure<br />
<br />
Private Structure POINTAPI<br />
Private x As Integer<br />
Private y As Integer<br />
End Structure<br />
<br />
Private Delegate Function GetWinMsgDelete(ByVal nCode As Integer, _<br />
ByVal wParam As Integer, _<br />
ByVal lParam As MSG) As Integer<br />
Private Function proGetWinMsg(ByVal nCode As Integer, ByVal wParam As Integer, ByVal lParam As MSG) As Integer<br />
If nCode = 0 Then<br />
If wParam = WM_PASTE Then<br />
MessageBox.Show("asdfsad")<br />
Return 1<br />
End If<br />
Return CallNextHookEx(hRet, nCode, wParam, lParam)<br />
End If<br />
End Function<br />
Public Sub GetMsg()<br />
hRet = SetWindowsHookEx(WH_GETMESSAGE, AddressOf proGetWinMsg, Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)).ToInt32, 0)<br />
End Sub<br />
Public Sub Unhook()<br />
If hRet <> 0 Then<br />
UnhookWindowsHookEx(hRet)<br />
hRet = 0<br />
End If<br />
End Sub<br />
End Module
Then i use it in form as follows
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
GetMsg()<br />
End Sub<br />
<br />
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing<br />
Unhook()<br />
End Sub
But i cann't make it right work.Why?
|
|
|
|
|
Hi Guys!! I need a function which can return me the free disk space of any drive for my Project of Bit Torrent Client in .Net. Thanx. Cya!!
Also i need to know how can we initialize all the elements of an array while declaring it. This is coz when ever i give Dim strArray() as String
and later when i use any element like: strArray(0) = "something"
i get an error on strArray saying that the array is beeing use before it can be be assigned a value. Plz help, What should i do???
Devraj Raut!!!
|
|
|
|
|
You declared an object as a pointer to an array, but you failed to tell the compiler how big to make the array:
Dim strArray(40) As String
will give you an array of 40 empty String objects.
Or, to expand on your code example, you could use something like this:
Dim strArray() As String
ReDim strArray(new size)
strArray(elementNumber) = "something"
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As for your Free Disk SPace problem. Google is your friend! Learn to use it. There's about a 245,000 hits when searching for "VB.NET get drive free space".
Click this[^] for an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
what is the role of module in vb.net?how it is used?
|
|
|
|
|
It's a deprectaed concept in VB.NET. It still works, but is merely a compatibility thing for VB6 code.
It was usually used as a function library that could be called from anywhere in your VB6 code.
In VB.NET, it's preferable to use Shared methods in classes instead of Modules.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Like Dave said, a Module is just a place to hold public functions and members. It is not a class. You can't make objects out of it. Its functions are directly accessible from the rest of your code, kind of like how the C language does it.
Public Module Foo
Public Sub Test()
End Sub
End Module
Public Class Bar
Public Sub Main()
Foo.Test() ' Can be called like this.
Test() ' Or like this, without specifying the module name.
End Sub
End Class
The problem with Modules in VB.NET is that all of their public members and methods will pollute your namespace. This really crowds intellisense. Because of this, I don't recommend that you use them.
|
|
|
|
|
Hello; can you help about how can i create crystal report in VB 6.0
thanks
|
|
|
|
|
In VB6 when you do
set frm2 = new Form2
frm2.show()
do you have to delete memory etc like in c++
|
|
|
|
|
yes.its good if you do.
set frm2=nothing
Kanchana
|
|
|
|
|
|
Setting the object to Nothing when you're done with it is good practicec, but not mandatory. The VB runtime will clean up objects that fall out of scope for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
VB6 is a memory managed language. There is no "delete".
The object will be deleted as soon as it's no longer referenced. This can occur when the last reference goes out of scope or is set to Nothing. And, unlike Java and .NET, the class' destructor will immediately be called just like how it is in C++.
Forms are treated a little differently in VB6. You can "mostly" force them out of memory by calling Unload like this...
Unload frm2
Once you do this, you can't use frm2 again. So in this case, you might as well as set it to Nothing, replace it with a new form reference, or just let the variable go out of scope.
|
|
|
|