|
Private Sub cmdPassValue_Click()
UserForm2.TextBox1 = Me.TextBox1
End Sub
|
|
|
|
|
Hi my friends, I need some help for syncronizing date and time on terminal with VB.NET.
The idea is set the date and time on the terminal with WinCE. The values are taken of PC.
somebody can help me with this problem?
best regards...
|
|
|
|
|
I have an application which reads values from the registry, now when the app loads, if the values dont exist, I am thrown an exception. Is there any way to stop this exception or to catch it. Or can i perhaps make a function or use a Try statement?
|
|
|
|
|
try will obviously do it. Otherwise, break down your registry code so that you check that you find a key, for example, before looking for a subkey or value.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am relatively new to vb.net and c#, do you know of any source that could help me do the above??
|
|
|
|
|
Take your existing code, and break it down. Every part that has a return value, take it and check it for Nothing ( null in C# ) before using it in the next step. If you post your line of code, I'll show you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
k what I first did was:
Dim rk as RegistryKey = {Key Goes Here}
Dim value as rk.GetValue("Value To Get")
Now i would normally do this before showing the form. So i would put this above the Windows Designer Code.
I think that might be where my problem is, but am unsure what other code to use. I use vb.net but may try and move to c++ or c#, as I need to be able to access hardware.
|
|
|
|
|
andyr2005 wrote:
Dim rk as RegistryKey = {Key Goes Here}
if rk is not nothing
Dim value as rk.GetValue("Value To Get")
end if
something like that ( I don't do VB ). Your problem is that rk is nothing, because the key is not there, and you're trying to access it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
So if i do something on the form load like
Try
Dim rk as RegistryKey = {Key Goes Here}
if rk is not nothing
then
Do something
elsedim value as rk.getvalue(value to get)
end if
would i be heading in the right direction?
|
|
|
|
|
Yes, your core problem would be that 'value' is scoped inside the if/else, so if you use it outside, declare it before the if/else so it's in scope.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
dim value as byte()
Try
Dim rk as RegistryKey = {Key Goes Here}
if rk is not nothing
then
Do something
else
byte = rk.getvalue(value to get)
end if
Better??
|
|
|
|
|
It's backwards. Remove the not
dim value as byte()
Try
Dim rk as RegistryKey = {Key Goes Here}
if rk is nothing
then
Do something
else
byte = rk.getvalue(value to get)
end if
If it's NOT nothing, then you can use it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Cheers for that.
When I read a value that is binary, i cant out put to a label, but is it possible to check the value against 5 or 6 others and set a list box value depending on the outcome?
|
|
|
|
|
andyr2005 wrote:
When I read a value that is binary, i cant out put to a label, but is it possible to check the value against 5 or 6 others and set a list box value depending on the outcome?
I'm not sure what you're asking ? A binary value is a bool, or do you mean a value that is data other than a string ? You can certainly compare a value to a collection of values, if they are all of the same type or there is an acceptable conversion.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
K for example i read a value which is 'REG_BINARY' and the value can be 01 28 00 08 or 01 00 40 0a. I need to compare the current value to like a list of available values that can be set. Now if i need to convert, that is the part that i will definetly get lost in.
|
|
|
|
|
What sort of variable are you storing that in ? It looks like a byte [] to me.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i just used byte as an example, am not sure what to store it in
|
|
|
|
|
OK, well it looks like a byte [] to me, not sure how else you're store it. But if it's in the registry, the registry API will assign a return type. Whatever it is, store your values to compare as the same type, then you can compare them.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Cheers for the help, i use the following code now which works:
Try
audiospeakersrightclick = Registry.CurrentUser.OpenSubKey("SOFTWARE\NVIDIA Corporation\NvMixer\Profiles", True)
If audiospeakersrightclick Is Nothing Then
combospeaker1.SelectedIndex = 0
combospeaker2.SelectedIndex = 0
audiospeakers.CreateSubKey("Profiles")
End If
Catch ex As Exception
End Try
Many thanks again.
|
|
|
|
|
k sorry bout this but I am having the same problem when reading binary values from the registry. Here's the code I am attempting to use:
Dim showadvanced, showfirewall As Byte
Try
nvmixersettings = audiospeakers.OpenSubKey("Settings", True)
showadvanced = nvmixersettings.GetValue("ShowAdvanced")
showfirewall = nvmixersettings.GetValue("ShowFirewall")
If showfirewall = Nothing Then
soundstormadvancedenable.Checked = False
soundstormadvanceddisable.Checked = True
soundstormfirewallenable.Enabled = False
soundstormfirewalldisable.Enabled = False
GroupControl13.Visible = True
End If
If showfirewall = 10000000 Then
soundstormadvancedenable.Checked = True
soundstormadvanceddisable.Checked = False
soundstormfirewallenable.Enabled = True
soundstormfirewallenable.Enabled = True
GroupControl13.Visible = False
End If
Catch ex As Exception
End Try
Now i have tried to Declare the variable type to string and byte and still no good, any other ideas??
|
|
|
|
|
Hi, how can I use MS Scan Wizard in my app?
Can I use and assign parameters to it?
Thanks
|
|
|
|
|
hellow to all ..
i am trying to chain a textbox name ,
i is integer ..
like textbox&"i"&.text
how can i do it ?
|
|
|
|
|
Wow - that's bizarre. To do that, you need to build the string first, then use reflection to turn it into a textbox instance. The neater way would be to build a hash table of indexes to textboxes. Oh, and if you put i in quotes, you get i, not i as an integer variable value.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
that's cool ...
i can do this with assembler in 30sec !
|
|
|
|
|
I keep getting the following error when trying to delete a row from a dataset using a datagrid (specifically the last row in the datagrid) :
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object.
Any ideas?
I know the err could be caused by a lot of things but..
Why just the last row?
If I start deleting records from the top, I can even delete the last row...but not just the last row ..
|
|
|
|