|
You should pass handle of the window for which you want to change text.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Thanks, but how do I obtain this value?
|
|
|
|
|
|
Alright, thanks it works!
|
|
|
|
|
Glad to help you
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I made a pretty easy loop but this loop runs 4 billion times this takes about 90 minutes to complete.
Now i would love to use my dual core and make it go faster!
Now my question how do i do this?
I can divide my loop in 2 and left loop1 do 1-50% and loop2 do 50-100%,
If i run this in 2 threads will that work?
Or do i need some other kind of code?
Also do i need threads or will background workers do?
Thanks!
|
|
|
|
|
It depends on what you are trying to accomplish. What operation is happening in the loop?
background workers are threads.
|
|
|
|
|
Im changing some bytes in a buffer, then preform a calculation with the buffer.
|
|
|
|
|
If you're not IO bound (ie the bottleneck is reading from the HD or copying the buffer from ram to cpu cache) splitting it in half and having 2 threads work at once would give a good speedup. If the modification/calculations are trivial though you're probably IO bound not CPU bound.
You know, every time I tried to win a bar-bet about being able to count to 1000 using my fingers I always got punched out when I reached 4....
-- El Corazon
|
|
|
|
|
|
I don't know if this is even possible, but I am looking for a way to programmatically tell whether a tablet is connected to the network wirelessly or is it connected to the network using a network cable plugged in. All the ways I've found just say whether it's connected or not and doesn't tell how it is connected.
Thanks for any help
Brent
|
|
|
|
|
System.Net.NetworkInformation.NetworkInterfaceType contains that info. Look in the System.Net.NetworkInformation namespace on how to access that information.
|
|
|
|
|
Thanks, that's exactly what I was looking for.
Brent
|
|
|
|
|
I have created an 'grid' of text boxes 17 (rows) by 20 (columns) within a groupbox.
This is like using a conrtol array in VB6.
I gave each a unique name e.g. txtboxR08C12 (row 8 column 12)
Just prior to adding the control to the group box I added an EventHandler to the textbox.
How can I identify in the EventHandler exactly which of the textboxes (preferably by name). So that I can amend the background colour and the contents to reflect a count (determined elsewhere in my code and stored in an array)
|
|
|
|
|
spd69,
The standard event param syntax is:
Event(object sender, EventArgs e);
Sender is the object which has raised the event, so in your case, it would be the textbox.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
dim x as textbox = ctype(sender,textbox)
if x.name = "txtboxR08C12" ....
(I think my vb syntax is correct)
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks for your answer
I mentioned vb6 as that is where I know control arrays from. But I was looking for a c# method.
Thank you for your time
|
|
|
|
|
TextBox tb = sender as Textbox;
if (tb.Name == ...
|
|
|
|
|
Sorry, I amswer questions in several forums. The same logic applies, cast sender to the right type and you can get the name.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
<br />
TextBox box = sender as TextBox;<br />
box will then become the textbox that has fired the event, and you can handle it accordingly.
|
|
|
|
|
thanks this worked a treat.
Sorry about the delay other matters took up my time until now (2:13am - lol)
Cheers
|
|
|
|
|
Hiya guys!
I'm new to this forum, and new to C#, and have hit upon a snag in a project i'm working on.
I am trying to load an existing webpage into .net, and populate the fields on this page.
So far, I have created a new web form, and I can grab data from the DOM.
I have found the fieldnames that I want to populate, but I have no idea how to populate them!
It looks like the webpage is read only, as I cannot set any properties.
Can someone please point me in the right direction?
Sorry if its a simple question, but I have only started learning c# this week.
Thanks in advance!
DB
|
|
|
|
|
You can get quick response, if you will post into the right forum.
Like your question is related asp.net, so it should be post into the Asp.Net section not C#.
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|
|
Hi Guys
I want to write a piece of code to automate a network printer installation on a vista client. I didn't found samples on the web with any possible solutions. I tried to use WMI but at this I have no solution for my problem
Every time when I run this code I habe an "Generic failure" when execute the printerObject.Put(options); method.
So I hope anyone of you can help me to find a reason to this issue.
Thanks in advanced.
Dany
Code:
public bool AddPrinter(string printerName, string printerDriver, string portName, bool sharedPrinter)
{
bool result = false;
try
{
//init Win32_Printer class
ManagementClass printerClass = InitClass("Win32_Printer");
SelectQuery selectQuery = new SelectQuery();
IPHostEntry iphe = Dns.Resolve(printerName);
string priterport = 9100.ToString() ;
//create new Win32_Printer object
ManagementObject printerObject = printerClass.CreateInstance();
//AddPrinterPort(portName, iphe.AddressList.GetValue(0).ToString(), priterport);
AddPrinterPort(portName, printerName, priterport);
if (portName == null || portName.Length == 0)
printerObject["PortName"] = "LPT1:";
else
{
//if (portName[portName.Length - 1] != ':')
// printerObject["PortName"] = (portName + ":");
//else
printerObject["PortName"] = portName;
}
//set driver and device names
printerObject["DriverName"] = printerDriver;
printerObject["DeviceID"] = printerName;
//set sharing
if (sharedPrinter)
{
printerObject["Shared"] = sharedPrinter;
printerObject["ShareName"] = printerName;
}
printerObject["comment"] = "Zeljko Philipp";
// specify put options: update or create
PutOptions options = new PutOptions();
options.Type = PutType.UpdateOrCreate;
//put a newly created object to WMI objects set
printerObject.Put(options);
result = true;
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("WMI exception: {0}", ex.Message);
throw new Exception(String.Format("WMI exception: {0}", ex.Message));
}
return result;
}
|
|
|
|
|
I can't seem to find anything to help my desktop application load a website and pass through the current logged in user.
I know I can get the current logged in user by
string NTUsername = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
and I have seen posts where you can specify the Username in the URL but neither are working
url = "http://username:" + NTUsername + "@subdomain.domain.com/default.aspx";
I have even tried to hard code in my username/domain. Can someone help give me some insight on how to pass the current logged in user to the web browser control?
|
|
|
|