|
Hi!
I want to get the "Company Name" which is entered by user when windows is being installed, i.e. which can be seen in General tab under "Registered to:" label, when we right click and select My Computer's properties.
I got the local user name through Environment.UserName but cant figure out how to get the "Company Name" of local user...i want to display this information on About dialog box of my application.
Hope i was able to clarify my question, thanks in advance...
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
You can get it from the registry
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization"
|
|
|
|
|
F16I,
Thanks alot, it solved my problem...
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
|
Hi all,
How can I convert point to inch or centimetre in C#?
Thanks,
Priyank
|
|
|
|
|
1 Point = 1/72 Inch
|
|
|
|
|
|
Hi,
I know this should be a simple task, but for some odd reason I can't get this to work correct.
I have a MaskedTextBox which is used to take a 5 digit number. My problem is since I made the box a little bigger than the size it would be with 5 digits in it, I want to set the focus to the beginning of the box if the user hasn't entered anything into it yet and clicks on the box to ensure they put in 5 digits.
I set up the event "Enter" with the following code:
if(maskedTB.Text.Length == 0)<br />
{ <br />
maskedTB.Focus();<br />
maskedTB.Select(0,0);<br />
maskedTB.Select();<br />
}
I tried each one of these individually and every combination of the three.
They all just set the focus to be wherever the user selected. So if they select on the area where the 5th digit resides it only allows them to enter 1 number and forces them to hit backspace until they get to the beginning.
Thanks.
|
|
|
|
|
try MaskedTextBox.SelectionStart
|
|
|
|
|
I've also tried to set the selectionStart = 0 to no avail.
|
|
|
|
|
Set the selection start property in the mouse down event of the masked text box. This should solve the issue.
private void maskedTextBox2_MouseDown(object sender, MouseEventArgs e)
{
if (maskedTextBox2.Text.Length == 0)
{
maskedTextBox2.SelectionStart = 0;
}
}
|
|
|
|
|
I have a listbox which is populated at runtime.I want to save the items of listbox in an array.How to save the items of listbox to an array in .Net using C#
|
|
|
|
|
Instead of Array use ArrayList or Dictionary, which is much faster then array.Here is the code snippets for ArrayList.
ArrayList arrList = new ArrayList();
ListBox objList = new ListBox();
//
//Code to store value in array list from Listbox after they are loaded in Listbox.
for (int i = 0; i < objList.Items.Count ; i++)
{
arrList.Add(objList.Items[0]);
}
//
//Code to get value from ArrayList.
for (int i = 0; i < arrList.Count; i++)
{
object objItem = arrList[0];
}
nJoy
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Id agree with Chintan however if it is definately an array you want to use then utilise the list boxes CopyTo property:
listBox1.Items.CopyTo(yourArray, index);
|
|
|
|
|
//Here, select any rows in your Datagrid view by mouse or tab key.
//just replace 'objView' with your data grid view name.
DataGridView objView = new DataGridView();
//This will return currently selected row.
DataGridViewRow row= objView.CurrentRow;
//Now here just specify the ColumnName and assign the updated value.In this case i have updated the column with string "Bill Gates".
row.Cells["ColumnName"].Value = "Bill Gates";
//Hop you understood.
//nJoy
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Hi,
I'm using RKLib Component for exporting data to Excel and it is working perfectly for me. But the drawback of this component is we can export data only to one excel sheet. Anybody have any idea of any component that will export data to excel to multiple worksheets? Any help in this regard would be great. Currently this application is windows. I would like to use the component, if available, in web also.
Thanks in advance
Meeram395
|
|
|
|
|
raja_raman wrote: 'm using RKLib Component
I don't know about that component as i never worked on that
One way is to use COM Objects that will loads the number of Excel sheets you want to load and transfer the data But the drawback of COM objects are bulky and you will have to take care of heap Memory as they will not definetly Garbage Collected .
Antoher way is using Micro of Excel Sheet that is faster and consume low memory
So choose your best option
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
how can i make a full row select in a datagrid, without using the row headers? im using visual studio.net 2003
|
|
|
|
|
Handle a mouse event and use HitTestInfo
private void DataGrid1MouseDown(object sender, MouseEventArgs e)<br />
{<br />
HitTestInfo hit = DataGrid1.HitTest(e.X, e.Y);<br />
<br />
if( hit.Type == HitTestType.Cell )<br />
DataGrid1.Select(hit.Row);<br />
}
only two letters away from being an asset
|
|
|
|
|
If you want this to be a permanent feature then I would do it by setting the grids SelectionMode property to be FullRowSelect.
This can be done through code:
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Or on the properties window.
|
|
|
|
|
Hi all,
I would like to know if C# enables this type of programming:
consider this example: an undetermined number of Cars coming from two sources to a car Park. The car park has to decide which car to let in the car park.
(1) How can I program such specification in C#? Do I need to use threading?? what type of programming capture this sort of requirement? functional doesn't seem to be a way.
road1 cars1[1,2,3,...n] --->
--> road3, waits for cars coming from road 1 or road 2
--> ..cars2[2], cars1[3], cars1[2],cars2[1],cars1[1]
road2 cars2[1,...m] ----->
(a) How does C# deals with two cars arriving in the same time?
(b) Does it handle deadlock
(c) Can this be exposed as a Web Service?
The reason why I want to know this is because I program Web Services a lot. Most Web services I programmed in C# are functions preceeded with the command "WebMethod" command so they can be exposed as Web services. In a recent conference I was asked if i can expose a process or a protocol as a web servce and couldn't answer it. The challenge with this type is they require many inputs coming at different times not like in functional style where all paramters are know and must have values when invoking the method.
Many thanks in advance
-- modified at 7:39 Wednesday 20th June, 2007
-- modified at 7:41 Wednesday 20th June, 2007
-- modified at 7:41 Wednesday 20th June, 2007
bye
|
|
|
|
|
This is not a language question, this is an architecture and design question.
C# can handle threading, concurrency and critial sections of code just fine. It can also be used to write methods that can be exposed as web methods (as you know).
Your question should be how do you go about setting up such as system as you describe above. Is will invariably require something to "maintain state" of the car park (such as a database, or a central server).
|
|
|
|
|
Hi, all
Is there any way to handle keypress event of textbox in C#. Actually I am working in asp.net I create a dyanmic table which contain some textbox. But after clicking Update button I am not able to access modified data inside the textbox.
Please help me...If u have any idea...
Thanks
Sapan
Life is full of happy Moments but If u are not stucking....
|
|
|
|
|
Hello,
this.textBox1.KeyPress+=new KeyPressEventHandler(textBox5_KeyPress);<br />
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
}
All the best,
Martin
|
|
|
|
|
Hi,
I have an xml file that was exported by my function. There is 36 fields in the products table. Now a user can select which fields he/she wants to export to the xml file, below is an example of what the xml file looks like:
<Products>
<Product>
<ID>5555</ID>
<ProductName>Yellow Marker</ProductName>
<Price>4</Price>
<Status>1</Status>
<ShortDescription>Short Description</ShortDescription>
<LongDescription>Long Description</LongDescription>
</Product>
</Products>
The tag name, for example <ProductName /> is the name of the field, with the value of the field between the tags.
Now my Product class has properties for each field. I normally set my fields like this:
Product p = new Product();
p.ID = "5555";
p.ProductName = "Yellow Marker";
p.Price = 4;
p.Status = 1;
p.ShortDescription = "Short Description";
p.LongDescription = "Long Description";
etc., etc., etc...
Now I only want to populate the properties that occurs as a tag. I need to do this dynamically. How do I do this? I can do Product p = new Product(); by hard code, but how do I do p. and the name of the field together so that it is recognised as, for example p.Price?
I hope I am making sense.
Regards
ma se
|
|
|
|