|
Hi Dave.
Thanks for your information.
But now the question is:
How to get the serial number (or better all manufacturer information) of a device?
Best regards.
Gussano
|
|
|
|
|
About the only things your going to get a serial number off of are the system (motherboard) and the hard drives. Manufacturers of video cards, CD drives, controllers and other peripherals usually don't supply this information in any way, shape, or form. There is no one Win32 API function that will return this information either.
If you use CIMStudio to search around WMI, you'll find that if you try to get the Manufacturer field off of, say, a CD drive, you'll get back "(Standard CD-ROM drives)". There is no SerialNumber field.
If you look for the VideoController, you'll find that there is no Manufacturer field, nor a SerialNumber field. The Manufacturer is listed under the AdapterCompatibility field. Doesn't make much sense, does it?
In short, you're looking to get information that is not supplied anywhere...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a windows form with a datagrid on it. When the user clicks a button 'Retrieve', it populates the datagrid with the appropriate data. A couple of the columns in this datagrid contain comboboxes in them.
I am using a class similar to the one in the article "DataGrid Zen Novice" to implement my comboboxes.
The problem I'm having is trying to figure out how to populate the values of one combobox, when a new item is chosen from another box. This has to be done for individual rows in the datagrid.
For example:
In my datagrid there is a column for item numbers, and a column for warehouses. If a new item number is chosen from the combobox in row three of the datagrid, the warehouses combobox in row three needs to be re-populated with the appropriate warehouses for this item.
Any ideas on the best way to do this?
Thanks in advance!
nadandjade
|
|
|
|
|
If I have a single WebBrowser control (either the managed wrapper in 2.0 or the ActiveX instance), is there anyway I can force it to draw to the screen multiple times without creating multiple instances of the control? Basically what I want to do is:
-------------------
<draw some html in here>
-------------------
<draw other html here>
-------------------
and so on. I know I can do this with the RichTextBox via P/Invoke (MSDN article on that here[^]), but that same P/Invoke trick doesn't seem to work on the WebBrowser control.
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
|
Hi everybody,
it seems to be so simple but ...
I want to store the contents of a multiline textbox into SQL-Server or MSDE.
Using the ntext or text field of the databases does not show the expected results.
The Database truncates all text comming from multiline textbox after a space or CRLF charakter.
The DataSet in memory stores the correct contents but the Database itself truncates the rest.
Is it because the multiline textfield is an array of string[] ?
do I have to iterate over the string field ?
Why does the DataSet does it right but the Database not ?
Thanks in advance
fracalifa
|
|
|
|
|
That depends on how your sending the information to the database. Are you using a parameterized query? What does your code that sends the info to the database look like? On top of that, you must store a single string, not an array of them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That' the code I am using for
private void data_update()
{
SqlDataAdapter adapter = new SqlDataAdapter();
string upd_CommandString = "UPDATE database_name SET textboxA=@textboxA WHERE id = " + id.ToString();
SqlCommand updateCommand = new SqlCommand();
updateCommand.CommandText = upd_CommandString;
updateCommand.Connection = conn;
adapter.UpdateCommand = updateCommand;
updateCommand.Parameters.Add(new SqlParameter("@textboxA", SqlDbType.NText,16,"textboxA"));
DRow.BeginEdit();
...
...
DRow["textboxA"]= this.txt_Multiline_Textbox.Text; // assign the multiline TB to DataRow object
...
...
DRow.EndEdit();
DB.open(ref conn); // connect Database
adapter.Update(Ds,"database_name");
DB.close(); // close Database
}
// The Database query simply looks like --> SELECT * FROM database_name WHERE id = 123
Whithin the Ds everything is fine, but not in the database field.
Using the database fieldtype NVarChar,4000 instead - everything looks fine -
Where is the fault ?
Thanks
fracalifa
|
|
|
|
|
The problem appears to be this line:
updateCommand.Parameters.Add(new SqlParameter("@textboxA", SqlDbType.NText,16,"textboxA"));
Your telling it that the parameter is a SQL NText field that is 16 bytes long. The type and size value you give it must match the definitions in your database table. If not, you run into screwy problems like this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello All,
I have a form that has 4 textboxes on it and a button. Initially the button is disabled but as soon as someone types/changes text in one of the text boxes I would like to enable the button. How can I detect changes in a text box ? Do I need to watch out for changes in each individual textbox or is it possible for the form to notify me that one of the textboxes changed ? Thanks in advance...
-Peter
|
|
|
|
|
Hi Peter,
I think the simplest solution is to add one EventHandler for the KeyPress-Event for all 4 textboxes.
For example the eventhandler can look like this:
<br />
private void txtTextBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {<br />
<br />
}<br />
To make sure that all 4 Textboxes calls this handler, simply click at the textbox (Forms-Designer in VS.NET) and select the flash-symbol from the properties page. There you have an entry called KeyPress and there you can select the method above.
Now you can call a method in this handler to verify the content of the textbox and do what you want with the button.
I hope this helps you.
Sebastian
P.S: Sorry for grammar and spelling...
|
|
|
|
|
To add the posting of Mr. SeMartens. If you want to do some specific task in the keyPress event of a perticular textBox , You can easily do the same. Below example illustrate the same.
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxesKeyPress);
this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxesKeyPress);
this.textBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxesKeyPress);
this.textBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxesKeyPress);
private void TextBoxesKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(sender == this.textBox1)
{
}
else if(sender == this.textBox2)
{
}
else if(sender == this.textBox3)
{
}
else if(sender == this.textBox4)
{
}
}
Do revert back whether it could solve your purpose or not
|
|
|
|
|
Hello guys,
This should have been simple, but im pretty stuck here.
I have an simple XML file where i want to change the content of the file. The file is as follows
config.xml
<Config>
<ReportServer>0</ReportServer>
<LastReportDate>20041214</LastReportDate>
</Config>
is there a simple way to change the content of the elements fx. <ReportServer> to a 1 instead of a 0 ??
Cheers
Ronni
|
|
|
|
|
yes there is simple way, use System.Xml.XmlDocument . Why don't you try XML forums?
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Here's some sample code for you:
using System;
using System.Xml;
class Class1
{
static void Main(string[] args)
{
string xmlpiece = @"<Config>
<ReportServer>0</ReportServer>
<LastReportDate>20041214</LastReportDate>
</Config>
";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlpiece);
XmlNode node = doc.SelectSingleNode("/Config/ReportServer");
node.InnerText = "1";
Console.WriteLine(doc.OuterXml);
}
}
Yes, even I am blogging now!
|
|
|
|
|
Why my program process a file in 6 minute and if I reprocess same file, it take 6 seconds. I am runing on xp operating system.
Thank you
|
|
|
|
|
"process" can mean anything! What, EXACTLY, are you talking about?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
My program read customer file consist of 9000 records. I process each record and it takes around 6 minutes to process those records, if I re-process this file again, it will take only 6 second to process same input file. It seems like XP operating system keep every thing in memory.
|
|
|
|
|
Hi
I have some strings and for each one I would like to call a specific function.
eg.
bla -> func()
blah -> func2()
etc..
I know I could use a hashtable, except c# doesn't have an eval function (as far as I know). How could it be done? At the moment I've got a switch for this, but this must not be the fastest way.
Thanks
|
|
|
|
|
You should check into System.Reflection[^] namespace, in particular, look at the MethodInfo[^] class, it contains a method called Invoke[^] that will allow you to dynamically call a method based on it's name and some additional information.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks very much, I've read a bit about it and come up with this code:
#region Using directives<br />
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Reflection;<br />
using System.Text;<br />
<br />
#endregion<br />
<br />
namespace ConsoleApplication1<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Type t = typeof(Program);<br />
object [] argsg = new object [] {100, 184};<br />
t.InvokeMember("ComputeSum", BindingFlags.Default | BindingFlags.InvokeMethod<br />
| BindingFlags.Static, null, null, argsg);<br />
}<br />
public static void ComputeSum(int num1, int num2)<br />
{<br />
Console.WriteLine(num1 + num2);<br />
Console.ReadKey();<br />
return;<br />
}<br />
}<br />
}<br />
Why does it generate a "MissingMethodException was unhandled" error?
Thanks again
|
|
|
|
|
I have a Object that inherits from ListViewItem. However, when a add this instance to the ListView, there is no text or whatever in it. If I add a SubItem, then the second column is populated but the first still not.
How can i display the value on my ListViewItem in the first column ?.
Thanks in advance
Well.. later
|
|
|
|
|
When you create your ListViewItem object, the string you pass as a parameter is what will be displayed in the first column.
For example
<br />
ListViewItem item = new ListViewItem("Text that will be displayed in the first column");<br />
item.SubItem.add("Text that will be displayed in the second column");<br />
Hope this helps
Hugo Migneron
|
|
|
|
|
We can pass a ListViewItem to the items.add methods of the ListView, I can't pass a string since a need to put object into the listview.
Well.. later
|
|
|
|
|
I am not sure i understand correctly what you are saying, can you post your code?
Hugo Migneron
|
|
|
|