|
|
Thanks Eddy
I thought so I have tried that before.
But after a while i saw that i had a bug somewhere in my code in another form.
Again Thanks From Kerkrade, Netherlands
|
|
|
|
|
My pleasure, greetings from the same Kerkrade
I are troll
|
|
|
|
|
can anybody tell me how i can display the mac address(physical address of a computer) in a text box on the click property of a command button in vb.net
thanks
|
|
|
|
|
|
Yuck. Have you tried the System.Net.NetworkInformation namespace?
Dim interfaces() as System.Net.NetworkInformation.NetworkInterface = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
For Each currentInterface as System.Net.NetworkInformation.NetworkInterface in interfaces
MessageBox.Show(currentInterface.GetPhysicalAddress().ToString())
Next
|
|
|
|
|
Looks easier to digest
I are troll
|
|
|
|
|
|
I am guessing you are using ASP.NET, make sure that on postback, you are not filling the data in. You need something like this:
if(!IsPostBack)
{
//Fill my GridView here
}
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
thanks for the reply
yes, i m using asp.net. will work on the solution
|
|
|
|
|
All the posts in here are about VB.NET, try to think about your subject line.
It's impossible to help without seeing some code. What value are you passing ? Is it ASP.NET ( if it is, you're in the wrong forum ) ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi All
I have a C++ DLL that performs some tasks and provides a regular update back to the VB.NET host so that a progress bar can be updated. The problem I have is that the callback fires once, but also exits the DLL for good.
Here is how my callback function is referenced in VB.NET
Imports System.Runtime.InteropServices
<UnmanagedFunctionPointer(CallingConvention.StdCall)> Public Delegate Sub controlProgressBarDelegate(ByVal progressValue As UInt32, ByVal message As String)
Public Declare Auto Sub CallBackTest Lib "CppTestDLL.dll" (ByRef arbitraryNum As Int32, ByVal pCallbackFunc As controlProgressBarDelegate)
The C++ DLL function "CallBackTest" is called via:
globalFuncsVars.CallBackTest(arbNumber, AddressOf controlProgressBar)
And the callback function, which simply updates a progress bar and puts any returned message string into a label, is:
Public Function controlProgressBar(ByVal progressValue As UInt32, ByVal message As String)
ProgressBar1.Value = progressValue
Label1.Text = message
Return 0
End Function
Obviously this is a very simple test example.
The code in the C++ DLL is:
typedef void (__stdcall progressCallback)(int progress, const char * p_msg);
extern "C" __declspec(dllexport) int __stdcall CallBackTest(int arbitaryNumber, progressCallback * p_progressCallback)
{
unsigned int counter = 0;
const char msg[12] = "Counting...";
for (unsigned int i = 0; i < 100; i += 1){
p_progressCallback(counter, msg);
counter += (i * 10);
for(unsigned int j=0; i < 100000; i++){}
}
return 0;
}
Again, a simple example where the counter goes from 0 to 100 in steps of 1 (with intervals of 100000 clock cycles... ish).
Now, when p_progressCallback is first called the first value of counter = 0 and the contents of the msg string are indeed returned to the VB.NET controlProgressBar function. However, there it stops, after the controlProgressBar function is executed the thread does not return back to the DLL.
Any thoughts?
Apologies if this is more a C++ issue rather than a VB.NET issue.
Kind regards, Kurt
|
|
|
|
|
Found an initial error (which doesn't seem to change the outcome). The delegate should be defined as:
<UnmanagedFunctionPointer(CallingConvention.StdCall)> Public Delegate Function controlProgressBarDelegate(ByVal progressValue As UInt32, ByVal message As String) As UInt32
perhaps... I mixed 'sub' with 'function' in my previous code. Still does not return to the DLL tho.
Also changed to C++ typedef to:
typedef unsigned int (__stdcall progressCallback)(int progress, const char * p_msg);
K
|
|
|
|
|
Well I'm not completely sure how I solved it, but it works fine now. A key change may have been to change the call from __stdcall to __cdecl - I found a few other silly mistakes, but I think this might have been the important change.
Bye for now, Kurt
|
|
|
|
|
In VB.Net 2005 how can i trap the checked/unchecked state of a datetimepicker through an event. I'm trying to execute two different methods based on the checked/unchecked state of a datetimepicker when the user clicks the datetimepicker. When the user checks the dtPicker Method A is executed, when the user unchecks it Method B is executed. How can i trap it.
Regards.
|
|
|
|
|
The datetimepicker does not have any checkboxes in it that I can see. It does have an event for when it's selected value changes.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
IIRC ancient VB had controls (datetimepicker, textbox, ...) with a built-in checkbox; I guess they invented the Nullable type long before .NET did
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
OK, good to know, but, he says he's using VB2005, does this mean he's not even bothered to create a control in the new IDE and assumes when he does, it will look like the old one ? If so, that would explain it, he's looked at the docs and found an event missing he expects to be there, because he's yet to actually create a control on a form ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
One mystery solved: .NET DateTimePicker has a built-in CheckBox too, it is hidden by default, but shows after setting ShowCheckBox true; and it signals trough the same ValueChanged event.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
OK, I did scan the MSDN but didn't see a property for it, then I created a datetimepicker on a form and looked at it to see if it had one.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
.NET DateTimePicker has a built-in CheckBox, it is hidden by default, but shows after setting ShowCheckBox true; and it signals trough the same ValueChanged event.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Well friends, the ValueChanged event only works when u change a datetime value of the control only. The control doesn't fire ValueChaged event when u enable or disable the checkbox in it. Though I managed it somehow by the MouseUp event but yet I want to find out another idea which fires as soon as someone enables or disables the checkbox.
|
|
|
|
|
Hi,
I ran a test using VB2008 before I posted, and the DateTimePicker fired a ValueChanged at every click on the checkbox.
This is the code used:
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
Console.WriteLine("ValueChanged: " & DateTimePicker1.Checked & " " & DateTimePicker1.Value)
End Sub
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Well Luc, when u check the checkedstate of the datetimepicker in that event then it's easy to trace it. But r u sure when u check/uncheck the control with mouse/keyboard while not changing its value then any event is fired or the respective methods for check/uncheck are executed? If yes then either i am missing something or this feature is not supported in VB2005/C#2005, b'coz i have checked it in my machine and it's not working here as u say. Plz aknowledge further.Regards.
|
|
|
|
|
My system is up-to-date; when I click the checkbox N times the ValueChanged event fires N times.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|