|
The only reliable way to get the serial number of the monitor is to turn it around and look at the tag with your Mark 1 Eye Ball.
It can be done in code, but not reliably. There is nothing in the EDID spec that says the manufacturer of a monitor has to supply the serial number in the data the monitor sends to the machine.
Here[^] is the code sample to do it. Be sure to read the code comments for why this will not work 100% of the time.
|
|
|
|
|
Hi All,
I'm developing an on-screen keyboard using VB.NET and need some advice. Currently, I'm using a few User32 API calls to GetActiveWindow() and SetActiveWindow(). Right now, I've got the active window handle number and using it as follows: SetActiveWindow(8975651603260375040), which seems to work... kind of. The desired window receives the focus but as the user types, the window receiving the focus flickers as my keyboard application sets focus to it just before it sends the keystroke to that window.
The keystroke is indeed sent to that window, but as suggested by another Code Project member, I would like for my keyboard to always keep the focus and then use SendMessage or SendInput to send the key strokes to the desired window that the user had previous selected before they began typing.
I've googled SendMessage, SendInput, etc, and not found many examples that illustrate window focus and how SendMessage actually works in the context of a virtual keyboard.
Any help would be much appreciated!!
Thank! -Patrick
|
|
|
|
|
i want to make a cell of a datagrid as a button...
i am using .NewRow predefined function to add a new row.. i am not using any data adapter neither data set... i am adding new row straight to the datagrid...
what should i need to do...
please help me...
i am using vb.net 2002.
if ever, much better if you can give me sample codes. thanks!
|
|
|
|
|
Depending on where the new row is added, you can use a RowDoubleClick or Click event to process the data in that field. For example, if the row is added to the end of the data grid, you can use a collection of the rows and access the last element of the collection array directly.
Then, you could systematically go through the cells you want to extract the data out of by passing the column name to one of the functions provided by the data grid class (something like SelectedIndex() or Index() and then you pass the name of the column).
Hope this helps.
|
|
|
|
|
i already know about that... but i really need to put a button in a cell. but thanx anyway...
|
|
|
|
|
Oh, sorry. Didn't understand what you meant. Good luck!
|
|
|
|
|
I'm creating a control and don't want it to be resizable. Most people say to hide it from the designer and throw an error when it's called, but I can't do that because the Size property isn't overrideable! Right now I set the size back the the default height and width in the resize event, but this may be confusing to the user as it looks resizable.
Thanks,
Nick
|
|
|
|
|
|
Thanks! I ran the example code there through a translator and found out you use the shadows keyword.
|
|
|
|
|
great
|
|
|
|
|
|
|
You can easily fix a controls size by overriding SetBoundsCore. It looks like this.
Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As System.Windows.Forms.BoundsSpecified)
Const fixedWidth As Integer = 50
Const fixedHeight As Integer = 50
MyBase.SetBoundsCore(x, y, fixedWidth, fixedHeight, specified)
End Sub
I know changing the size back in the resize event will also work, but doing it that way actually allows the control's size to be changed and then it quickly changes it back. Overriding SetBoundsCore will prevent the change from ever occurring.
|
|
|
|
|
hi All
i have a textbox that sometimes Should be Null and my table field is Nullable. When the textbox has no Entry i want to put Null in my Field.
thanks
Vuyiswa
|
|
|
|
|
Then check the Text property on the text box. If it is an empty string String.Empty then put null (DBNull.Value ) in your column, otherwise put the value of the Text property in.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Thanks you For your reply.
i understand the Logic, if the textbox is Empty string the set it to Null, but code wise i dont understand. please post me a skeleton code to learn from it.
Thanks Colin
Vuyiswa
|
|
|
|
|
If textbox.text = nothing then
field = "Null"
End If
Just make sure you replace textbox and field .
You also might want to use textbox.text.trim to remove any whitespace on the ends of the text to help 'idiotproof' it.
|
|
|
|
|
Hi when i run my code it tells me "Cant Store Null in Extension Field" , but my table does Accept Null in that Field.
Here is the code in my save Button for Field Extension.
Dim newRow As DataRow = DataSet11._PROPERTY.NewRow<br />
'newRow("Num_key") = CStr(txtnumkey.Text)<br />
If txtextension.Text.Empty.Trim = Nothing Then<br />
newRow("Extension") = "Null"<br />
Else<br />
newRow("Extension") = txtextension.Text<br />
End If<br />
-- modified at 10:51 Monday 2nd July, 2007
Vuyiswa
|
|
|
|
|
Here's a problem:
If txtextension.Text.Empty.Trim = Nothing Then
You don't want txtExtension.Text.Empty. That returns nothing itself, so the condition will always be true. You just need txtextension.Text.Trim , which returns the textbox's text with now whitespace at the ends.
|
|
|
|
|
i have remove the Empty keyword. and when i try to save in the dataset,
it Gives me this Error
<br />
unable to Add the Record<br />
System.FormatException:Input string was not a Correct Format.<br />
at System.Number.Parse(string s,NumberStyles style,NumberFormatifno info)<br />
at system.int32.Parse(string s,NumberStype style,IFormatProvider provider)<br />
at System.String.system.IConvertible.Toint32(IFormatProvider Provider)<br />
at system.convert.Toint32(Object Value)<br />
at System.Data.Common.Int32Storage.Set(int32 record,Object Value)<br />
at System.DataCoulmn.set_Item(int32 record,Object Value) couldnt store<Null> in Extension Column. Expected type int32<br /> .
Please Sir Remember that my Field is numeric and it Allow Null, and in my Field there is a Default that i bind to the Table for Null Values if there is none and the table Defination is Nullable.
Thanks
Vuyiswa
|
|
|
|
|
The table is numeric. While it may allow a null value, it doesn't allow "null" as a string, which is what I was telling you to do. Instead of using
If txtextension.Text.Empty.Trim = Nothing Then<br />
newRow("Extension") = "Null"<br />
Else
you can set the row to something like -1, 0, nothing, or another default value you choose. You can also set it to dbnull.value
|
|
|
|
|
Aren't you looking to put DbNull.Value in there instead of the string "Null"??
|
|
|
|
|
Well Dave you Solved the Problem, here is a Complete Code
<br />
Dim newRow As DataRow = DataSet11._PROPERTY.NewRow<br />
newRow("Num_key") = CStr(txtnumkey.Text)<br />
If txtextension.Text.Trim = Nothing Then<br />
newRow("Extension") = DBNull.Value<br />
Else<br />
newRow("Extension") = txtextension.Text<br />
End If<br />
and Now i have i have to save the Dataset to the Database by with the Update method. here is my code
<br />
Dim strErrorMsg As String<br />
Dim strerror As System.Data.SqlClient.SqlError<br />
'save the datasource Changes<br />
If mblnIsDirty Then<br />
If MessageBox.Show("Do you want to Save the Changes?", "Property", _<br />
MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then<br />
' Checking for Error in the dataset<br />
Try<br />
SqlDataAdapter1.Update(DataSet11, "Property")<br />
Catch<br />
MessageBox.Show("Error saving Data in the DataBase", "Property")<br />
<br />
End Try<br />
End If<br />
End If<br />
if i try to update, it Brings
<br />
An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll<br />
<br />
Additional information: Missing SourceTable mapping: 'Property'<br />
-- modified at 12:02 Monday 2nd July, 2007
Vuyiswa
|
|
|
|
|
Vuyiswamb wrote: SqlDataAdapter1.Update(DataSet11, "Property")
Apparently, you don't have a datatable in DataSet11 (very bad name by the way), called "Property".
|
|
|
|
|
Thanks Dave for your time.
yes i know that the Table "Property" named i used is very Bad, but its the name of the table, sometimes to find my way around in my code i had to prefix it with an underscore, because Property is a keyword in VB. i have redefined the Dataset11 and it does not give an error anymore, but still the data does not reflect in my table.
<br />
Dim strErrorMsg As String<br />
Dim strerror As System.Data.SqlClient.SqlError<br />
'save the datasource Changes<br />
If mblnIsDirty Then<br />
If MessageBox.Show("Do you want to Save the Changes?", "Property", _<br />
MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then<br />
' Checking for Error in the dataset<br />
Try<br />
<br />
SqlDataAdapter1.Update(DataSet11, "Property")<br />
Catch ExSQL As System.Data.SqlClient.SqlException<br />
MessageBox.Show(strErrorMsg, "SQL Server Error: " & strerror.Number, MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
End Try<br />
End If<br />
End If<br />
let me find a way out of this, if i dont i will shout
Vuyiswa
|
|
|
|
|