|
At a guess you;ll need to set up a global keyboard hook to do that. Hooking the read event will let you access input to any application which mean's you're tying into a low level OS component, afaik the send event is at the same level.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Why not just disable the screensaver while your program is running? As shown here[^] or maybe here[^]
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hello!
I've created a static class (S) that is extended by a dynamic class (D) during run-time. That means D inherits S and appends some new properties to it, by using System.Reflection.Emit (thanx to the great articles here).
How do I reference the class that does _not_ exist at compile-time? The following article for example, shows how to bind methods. But in that example, the class itself does exist and thus can be found by the compiler. http://msdn.microsoft.com/en-us/library/k3a58006.aspx[^]
Cheers!
Hendrik
|
|
|
|
|
hi guys! what's up
here is my question..
hi!! i made an application and i want to save into my databae the datas from some textboxes. when i click the save button the datas are being normally or at least that's what i thought...
sometimes tha datas are being displayed sometimes not. for example, i run visual studio 2008 c# at 8 pm. and i can see the datas which i inserted before, i close studio,,, after a while i run again studiio and tha datas have gone....Frown
the code is correct..
Please help me guys, i really need your help.
sorry for my english
here is the comands
private void InitializeCommands()
{
//INSERT
dataAdapter.InsertCommand = conn.CreateCommand();
dataAdapter.InsertCommand.CommandText =
"SET IDENTITY_INSERT Producer ON insert into Producer(Pid,AFM,LastName,FirstName,City,ZipCode,Adress) values(@Pid,@AFM,@LastName,@FirstName,@City,@ZipCode,@Adress)";
AddParams(dataAdapter.InsertCommand, "Pid", "AFM", "LastName", "FirstName", "City", "ZipCode", "Adress");
//UPDATE
dataAdapter.UpdateCommand = conn.CreateCommand();
dataAdapter.UpdateCommand.CommandText =
"update Producer set AFM=@AFM, LastName=@LastName, FirstName=@FirstName, City=@City, ZipCode=@ZipCode, Adress=@Adress where Pid=@Pid ";
AddParams(dataAdapter.UpdateCommand, "Pid", "AFM", "LastName", "FirstName", "City", "ZipCode", "Adress");
//DELETE
dataAdapter.DeleteCommand = conn.CreateCommand();
dataAdapter.DeleteCommand.CommandText =
"delete from Producer where Pid = @Pid";
AddParams(dataAdapter.DeleteCommand, "Pid");
}
the add paremateres method
private void AddParams(SqlCommand cmd, params string[] cols)
{
foreach (string col in cols)
{
cmd.Parameters.Add("@" + col, SqlDbType.NVarChar, 0, col);
}
}
the insert button
private void btnAdd_Click(object sender, EventArgs e)
{
insertRec = true;
DataRow row = dt.NewRow();
dt.Rows.Add(row);
//MessageBox.Show(totalRec.ToString());
totalRec = dt.Rows.Count;
curRec = totalRec-1;
row["Pid"] = totalRec;
txtpid.Text = totalRec.ToString();
txtAFM.Text = "";
txtln.Text = "";
txtfn.Text = "";
txtCity.Text = "";
txtZip.Text = "";
txtAdr.Text = "";
btnSave.Enabled = true;
}
and the save button
private void btnSave_Click_1(object sender, EventArgs e)
{
DataRow row = dt.Rows[curRec];
//MessageBox.Show(totalRec.ToString());
//MessageBox.Show(curRec.ToString());
row.BeginEdit();
row["Pid"] = txtpid.Text;
row["AFM"] = txtAFM.Text;
row["LastName"] = txtln.Text;
row["FirstName"] = txtfn.Text;
row["City"] = txtCity.Text;
row["ZipCode"] = txtZip.Text;
row["Adress"] = txtAdr.Text;
row.EndEdit();
dataAdapter.Update(ds, "buffer");
ds.AcceptChanges();
CreateDir();
ToggleControls(true);
insertRec = !true;
}
i havevreated the dataset,dataadapter, the conection string and the datatable of cours
|
|
|
|
|
Double posting won't give you twice as many answers compared to posting only once. More likely the amount is 1/(NumberOfRepeats).
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
ASALAMOALEKUM all,
hope everyone is fine!
i hav a task to accomplish as soon as possible by the end of october, due to other projects i was unable to work on this uptil now and if now i start my search from scratch it will consume too much time as i know its not a small task...
i want to make video indexer...
for which i wana know libraries for video/audio editing in C#
i have tried my best for searching .NET SDKs (my requiremnt) which help me extracting audio from video, calculating frequency time values of sound of video but i didnt find any such which may help!
please if anyone of you have any idea do help me i will be verythankful to u!
thanks in adv.!
regards,
SANA AHMAD
GOD BLESS US!
$@N@
|
|
|
|
|
.NET does not natively support audio/video editing. You will have to resort to using .NET compliant third-party SDKs such as DirectX.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
|
hi guys! what's up
here is my question..
hi!! i made an application and i want to save into my databae the datas from some textboxes. when i click the save button the datas are being normally or at least that's what i thought...
sometimes tha datas are being displayed sometimes not. for example, i run visual studio 2008 c# at 8 pm. and i can see the datas which i inserted before, i close studio,,, after a while i run again studiio and tha datas have gone....Frown
the code is correct..
Please help me guys, i really need your help.
sorry for my english
here is the comands
private void InitializeCommands()
{
//INSERT
dataAdapter.InsertCommand = conn.CreateCommand();
dataAdapter.InsertCommand.CommandText =
"SET IDENTITY_INSERT Producer ON insert into Producer(Pid,AFM,LastName,FirstName,City,ZipCode,Adress) values(@Pid,@AFM,@LastName,@FirstName,@City,@ZipCode,@Adress)";
AddParams(dataAdapter.InsertCommand, "Pid", "AFM", "LastName", "FirstName", "City", "ZipCode", "Adress");
//UPDATE
dataAdapter.UpdateCommand = conn.CreateCommand();
dataAdapter.UpdateCommand.CommandText =
"update Producer set AFM=@AFM, LastName=@LastName, FirstName=@FirstName, City=@City, ZipCode=@ZipCode, Adress=@Adress where Pid=@Pid ";
AddParams(dataAdapter.UpdateCommand, "Pid", "AFM", "LastName", "FirstName", "City", "ZipCode", "Adress");
//DELETE
dataAdapter.DeleteCommand = conn.CreateCommand();
dataAdapter.DeleteCommand.CommandText =
"delete from Producer where Pid = @Pid";
AddParams(dataAdapter.DeleteCommand, "Pid");
}
the add paremateres method
private void AddParams(SqlCommand cmd, params string[] cols)
{
foreach (string col in cols)
{
cmd.Parameters.Add("@" + col, SqlDbType.NVarChar, 0, col);
}
}
the insert button
private void btnAdd_Click(object sender, EventArgs e)
{
insertRec = true;
DataRow row = dt.NewRow();
dt.Rows.Add(row);
//MessageBox.Show(totalRec.ToString());
totalRec = dt.Rows.Count;
curRec = totalRec-1;
row["Pid"] = totalRec;
txtpid.Text = totalRec.ToString();
txtAFM.Text = "";
txtln.Text = "";
txtfn.Text = "";
txtCity.Text = "";
txtZip.Text = "";
txtAdr.Text = "";
btnSave.Enabled = true;
}
and the save button
private void btnSave_Click_1(object sender, EventArgs e)
{
DataRow row = dt.Rows[curRec];
//MessageBox.Show(totalRec.ToString());
//MessageBox.Show(curRec.ToString());
row.BeginEdit();
row["Pid"] = txtpid.Text;
row["AFM"] = txtAFM.Text;
row["LastName"] = txtln.Text;
row["FirstName"] = txtfn.Text;
row["City"] = txtCity.Text;
row["ZipCode"] = txtZip.Text;
row["Adress"] = txtAdr.Text;
row.EndEdit();
dataAdapter.Update(ds, "buffer");
ds.AcceptChanges();
CreateDir();
ToggleControls(true);
insertRec = !true;
}
i havevreated the dataset,dataadapter, the conection string and the datatable of cours
|
|
|
|
|
If you're using an Access database as part of your project, you application is modifying a copy of the database made in the bin folder of your project. WHen you come back to the project and run it again, the .MDB file in the bin folder is overwritten with the copy of the database as it was when you added it to the project.
|
|
|
|
|
ok,i solve it, hank you very much
|
|
|
|
|
Is there C# code that will take an image and a list of RGB values and make the image out of the RGB colors with floyd steinberg dithering?
|
|
|
|
|
afjepoifesahie wrote: there C# code that will take an image and a list of RGB values and make the image out of the RGB colors with floyd steinberg dithering?
Is there some problem Googling for "floyd steinberg dithering c#" for examples and libraries?
|
|
|
|
|
But that would be too easy. Clearly this person likes a challenge!
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
I'm needing a little help figuring out the best way to check if a table exist in an access DB and then set a flag to create the Table. I want to set this up with reusable code.
right now i am setting the commandtext with the SQL query that I want to convert to varaibles but want to figure out how I want to do this first because it is most likely part of the overall solution for this.
I'm opening the Database reading the GetSchema and reading each table name and have an array of my tables that the program is going to create, I can compare these but I'm getting lost on how to keep three array's in sync with out putting in individual checks for each table. yes the code below only has 5 tables but this application is going to grow in future versions and i don't want to have to go back and recode this or add checks for each table.
string[] NATables = new string[5];
NATables[0] = "Group Policy";
NATables[1] = "GPO Computer Settings";
NATables[2] = "GPO User Settings";
NATables[3] = "GPO Links";
NATables[4] = "GPO Delegation";
String connect = "Provider=Microsoft.JET.OLEDB.4.0;data source=.\\Test.mdb";
OleDbConnection con = new OleDbConnection(connect);
con.Open();
OleDbCommand cmd = con.CreateCommand();
DataTable dt = con.GetSchema("tables");
con.Close();
DataRow[] rows = dt.Select();
for (int i =0; i < rows.Length; i++ )
{
string r = rows[i]["TABLE_NAME"].ToString();
for (int j = 0; j < NATables.Length; j++)
{
if (r == NATables[j])
{
}
else
{
}
}
}
con.Open();
cmd.CommandText = "CREATE TABLE [Group Policy]([GPO GUID] Text(50) NOT NULL Unique PRIMARY KEY,[GPO NAME] TEXT(50) NOT NULL,[GPO Domain] TEXT(50) NOT NULL,Created datetime NOT NULL,Modified datetime NOT NULL,Status TEXT(10) NOT NULL)";
try
{
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
|
|
|
|
|
Not quite sure what the problem is but perhaps a little bit different approach could be useful to you:
- create a class that represents a table with properties such as table name, create statement, to be created bit (which defaults to true)
- create an instance for all of your tables
- place the created instances to a generic dictionary (
Dictionary<string,> ), place the table name to the key of the dictionary item - after this get the schema
- loop every row found from schema and set the corresponding item in the dictionary to not to create the table
- after this you can loop the dictionary and execute every create statement from the instances where create bit is still true
- the instances can be created based on for example a xml file if you want to add tables without modifying the code (in this case take good care for the seurity issues)
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
i used two arrays and rewrote my SQL execute to a function and used two for loops, i might convert the Arrays to XML or store in a config file down the road but for now I have this part 100% done have to move on to the main focus of the solution i am working on parsing a very nested XML file
Thanks for your suggestions
bool create = false;
for (int j = 0; j < NATables.Length; j++)
{
create = true;
for (int i = 0; i < rows.Length; i++)
{
string r = rows[i]["TABLE_NAME"].ToString();
if (r == NATables[j])
{
create = false;
return;
}
}
if (create == true)
{
string strQuery = CTquery[j];
RunSQLQuery(strQuery);
create = true;
}
}
|
|
|
|
|
You're welcome.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
i have three treeviews and they used the same database to but use difrent table to populate.
I have written the code i just dont know how i am going populate the Others.
Please help
This is my code that i have done
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Collections;
using System.Data.SqlClient;
namespace Envision
{
public partial class Envision : Form
{
SqlConnection conn = new SqlConnection("Data Source=ICNWS00054;Initial Catalog=EnvisionPlatformDatabase;User ID=sa;Password=3Password5");
SqlDataAdapter dtd;
DataSet ds;
DataView dv;
public TreeNode node;
public Envision()
{
InitializeComponent();
}
//
private void GetData(int EnCid, TreeNode EnNode)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "EnCid=" + EnCid;
int dvC = dv.Count;
if (EnNode == null)
{
int i = 0;
while (i &lt; dvC)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "EnCid=" + EnCid;
TreeNode node = new TreeNode();
node.Text = dv[i]["EnNode"].ToString();
node.Tag = int.Parse(dv[i]["NodeId"].ToString());
this.treeView1.Nodes.Add(node);
GetData((int)node.Tag, node);
i++;
}
}
else
{
int i = 0;
while (i &lt; dvC)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "EnCid=" + EnCid;
TreeNode node = new TreeNode();
node.Text = dv[i]["EnNode"].ToString();
node.Tag = int.Parse(dv[i]["NodeId"].ToString());
EnNode.Nodes.Add(node);
GetData(int.Parse(dv[i]["NodeId"].ToString()), node);
i++;
}
}
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
ArrayList EnvisionP = new ArrayList();
TreeNode EnNode = new TreeNode("EnNode");
EnNode.Tag = EnvisionP;
dtd = new SqlDataAdapter("select * from [User Panel] order by NodeId", conn);
ds = new DataSet();
dtd.Fill(ds, "User Panel");
GetData(0, null);
}
private void ultraExplorerBar1_ItemClick(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e)
{
}
private void treeView1_AfterSelect_1(object sender, TreeViewEventArgs e)
{
}
private void treeView2_AfterSelect(object sender, TreeViewEventArgs e)
{
}
private void ultraListView1_ItemActivated(object sender, Infragistics.Win.UltraWinListView.ItemActivatedEventArgs e)
{
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
|
|
|
|
|
Hello dear friend,
It's clear that you are new in CP. So read the first post of page1, titled "How to get an answer to your question" by "Chris Maunder", it will guide you how to post your questions. Take a look here[^] and here[^] for more info.
Have a nice journey here in CP
While (true) { Human.isLearnable = true; }
|
|
|
|
|
|
|
Thank You Very Much
|
|
|
|
|
Let's see... not too familiar with sarcasm, aren't we?
|
|
|
|
|
|