|
|
Add this line to the top of your codefile:
using System.Runtime.InteropServices;
Then add these lines of code after the open brace in Form1 (or whatever your form is called):
private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
<br />
[DllImport("user32.dll")]<br />
private static extern void mouse_event(<br />
UInt32 dwFlags,<br />
UInt32 dx,<br />
UInt32 dy,<br />
UInt32 dwData,<br />
IntPtr dwExtraInfo<br />
);
To simulate a left click, you would then use this code:
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, new System.IntPtr());
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, new System.IntPtr());
And that's it!
- Virtual1ty
|
|
|
|
|
Dear all,
here i have done a grid node like user control for displaying the items in each and every page
in that grid i have a dropdown list for selecting the feature of the item . here i has to fetch the fetch the feature from database and based upon that i has to display.
the below i had written but it is not working
so please help me
Thanks and Regards
protected void gridnode1_SelectedIndexChanged(object sender, EventArgs e)
{
dsfeature = con.GiveDataSet("select features from b2bpattributes ,b2bproducts where b2bpattributes.productgroup in (select productgroup from b2bproducts where productid='" + str2 + "') and b2bpattributes.productid=b2bproducts.productid and b2bproducts.available='Online'");
//select features from b2bpattributes where productgroup in (select productgroup from b2bproducts where productid='" + str2 + "' and available='Online')");
if (dsfeature.Tables[0].Rows[0]["features"].ToString() != "")
{
if (dsfeature.Tables[0].Rows.Count != 1)
{
//lblfeature.Visible = false;
ddlfeature1.DataSource = dsfeature;
ddlfeature1.DataTextField = "features";
ddlfeature1.DataBind();
}
else
{
//lblfeature.Visible = true;
lblfeature.Text = dsfeature.Tables[0].Rows[0]["features"].ToString();
ddlfeature1.Visible = false;
//lblselect.Visible = false;
}
}
else
{
ddlfeature1.Visible = false;
//lblselect.Visible = false;
}
}
sai krishna
|
|
|
|
|
I recently read an article about how Passing data between forms.(http://www.codeproject.com/useritems/pass_data_between_forms.asp)
What it fails to explain(or I fail to understand) is how do I do it whilst I don't create objects of the form?
Here is the code below, abit long but simple...
I want data from the second form to be passed to the first form(then I could show it with labels)
[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AutoDownloader
{
public partial class Form1 : Form
{
public Form1()
{
Initiailize();
}
public void Initiailize()
{
this.Width=800;
this.Height=400;
this.StartPosition= FormStartPosition.CenterScreen;
Button AddShow = new Button();
AddShow.Click+=new EventHandler(AddShow_Click);
AddShow.Top = 300;
AddShow.Left = 20;
AddShow.Width = 100;
AddShow.Text = "Add New Show";
this.Controls.Add(AddShow);
}
public void AddShow_Click(object sender, System.EventArgs e)
{
AddShowForm subform=new AddShowForm();
subform.Show();
}
}
public class AddShowForm : Form
{
Label NewShow = new Label();
Label DownloadDate = new Label();
Label DownloadTime = new Label();
Label DownloadWebsite = new Label();
TextBox tNewShow = new TextBox();
TextBox tDownloadDate = new TextBox();
TextBox tDownloadTime = new TextBox();
TextBox tDownloadWebsite = new TextBox();
Button Save = new Button();
Button CloseForm = new Button();
public AddShowForm()
{
Start();
}
public void Start()
{
this.Width = 600;
this.Height = 250;
this.StartPosition = FormStartPosition.CenterScreen;
NewShow.Left = 10;
DownloadDate.Left = 10;
DownloadTime.Left = 10;
DownloadWebsite.Left = 10;
NewShow.Top = 20;
DownloadDate.Top = 50;
DownloadTime.Top = 80;
DownloadWebsite.Top = 110;
tNewShow.Left = 330;
tDownloadDate.Left = 330;
tDownloadTime.Left = 330;
tDownloadWebsite.Left = 330;
tNewShow.Top = 20;
tDownloadDate.Top = 50;
tDownloadTime.Top = 80;
tDownloadWebsite.Top = 110;
NewShow.Width = 300;
DownloadDate.Width = 300;
DownloadTime.Width = 300;
DownloadWebsite.Width = 300;
CloseForm.Click += new EventHandler(CloseForm_Click);
Save.Click += new EventHandler(SaveData);
Save.Top =150;
Save.Left = 10;
CloseForm.Top = 150;
CloseForm.Left =100;
Save.Text = "Save Data";
CloseForm.Text = "Close";
NewShow.Text = "Enter the name of show to search:";
DownloadDate.Text = "Enter the date you'd like to download the show:";
DownloadTime.Text = "Enter the time you'd like to download the show:";
DownloadWebsite.Text = "Enter the name of website which you want to download from:";
this.Controls.Add(NewShow);
this.Controls.Add(DownloadDate);
this.Controls.Add(DownloadTime);
this.Controls.Add(DownloadWebsite);
this.Controls.Add(tNewShow);
this.Controls.Add(tDownloadDate);
this.Controls.Add(tDownloadTime);
this.Controls.Add(tDownloadWebsite);
this.Controls.Add(Save);
this.Controls.Add(CloseForm);
}
public void CloseForm_Click(object sender, System.EventArgs e)
{
this.Visible = false;
}
public void SaveData(object sender, System.EventArgs e)
{
this.BackColor = Color.Red;
}
}
}
[/code]
|
|
|
|
|
XFighter wrote: I recently read an article about how Passing data between forms.(http://www.codeproject.com/useritems/pass_data_between_forms.asp)
If it is an issue with an article, the best bet route should be to initiate a thread over the article's forum.
|
|
|
|
|
I am opening afile through
foreach(string eachfile in ArrayOfFile)
{
System.IO.StreamReader sr = new System.IO.StreamReader(eachfile,FileMode.Open,FileAccess.Read);
System.Text.StringBuilder strAllText = new System.Text.StringBuilder();
}
I want that if any one file is not access or not open then it will throw a error msg only and continue to read another file..
if anyone has solution then plz reply
|
|
|
|
|
|
Very smart..
I had posted that msg in MSDN..
if you know abt this then reply
|
|
|
|
|
An 'Answer' was already marked out there. You can try figuring out any open handles on the files. But you may need to delve into P/Invoke for this.
|
|
|
|
|
I think u didn't read all the messages...
Thanks
|
|
|
|
|
You can prevent other users from accessing the file by specifying exclusive access when you open/create the file. Check the FileAccess versions of FileStream's constructor documentation for more info:
new FileStream(filePathName, FileMode.Open, FileAccess.Read, FileShare.None);
caveats:
- if you can't open the file with FileShare.None then a System.IOException will be thrown.
- ALWAYS code FileStream with the keyword "using" so that resources are freed if an exception is thrown.
Source Courtesy: http://www.dotnet247.com/247reference/msgs/55/279414.aspx[^]
|
|
|
|
|
I have a seperate project in my application with a great deal of code in that can take upto a minute to perform when performing a save on the main UI. The saving of this information is not required for the UI to continue working.
I have been investigating the BackgroundWorker class, I was hoping somebody would know of good code examples which would allow me to change the application so that when the main UI calls any methods on the seperate project these methods are all run on a seperate thread so that the main
UI does not wait for them to complete which results in a moderate amount of the hanging.
It seems I would have to use the BackgroundWorker on the method calls in the Main UI whereas I would like to simply have anything on this seperate project always run on a seperate thread.
I hope I have made sense as it is rather early.
Thank you for any help and sugestions you may have.
|
|
|
|
|
|
Hey everyone,
I might be doing it the wrong way, but I had to filter a dataset and view it in a datagrid to match a value in an outer control "treeview node in this case", anyhow, after filtering that, I had to fill the entire column which's supposed to be the foriegn key column with value of that outer control value "primary key", is there an easier/other way to do it?? other wise how do you manage to fill a datagrid control entire available column with copies of my primary key value??
Please help.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
ok i did it...
int iRowCount = MyDataset.Tables[TableName].Rows.Count;
if (iRowCount > 0)
{
for (int x = 0; x < iRowCount; x++)
MyDatagrid[x, MyTree.SelectedNode.Level] = MyValue;
}
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I develop using VC before,and changed to C# now.
In VC,there is an active control named CMSChart,which can be used to draw bar,line and pie chart arbitarily.
Anybody would like to tell me is there have such a component to do the same job in C#?
Thanks.
GOOD LUCK
|
|
|
|
|
|
|
Which is this language?
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Sonia Gupta wrote: Which is this language?
BrainFuck[^]
|
|
|
|
|
l;aksdj fl;k alksdj flkajs dfklja dsf?? alskdjf ;als df ;klas djflk;a dsjf..
asdj alkjsd lkajsd lkfj a?? alsdkf a;lskd fj lkajs dklfj asdlk;f??
dlaksdj:->
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
However, this looks for me like a definitive language instead of just scribble but my system missing fonts. Just like viewing Tamil blogs in FireFox with Indic IME disabled.
|
|
|
|
|
'Newbie Learning to Type' on a QWERTY keyboard.
|
|
|
|
|
Not necessarily. These keys have the same location on other keyboards, such as AZERTY.
Lets await his progress.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: AZERTY
I just knew about one more type of keyboard layout and made a research on this from Wikipedia (http://en.wikipedia.org/wiki/AZERTY[^])
But wouldn't such diversified standards be daunting for frequent business travellers?
|
|
|
|