|
can u give an example
This code was posted by me...
|
|
|
|
|
MS has invested a lot in preparing documentation. Read it.
|
|
|
|
|
from where can i get the documentation
This code was posted by me...
|
|
|
|
|
|
Vivek Vijayan wrote: get the mouse position
You want it globally or with context to your application only? To find find it globally, you can use GetCursorPos()[^]. It is a Windows API function and you will need to import user32.dll to use it. (Just scroll down to the bottom of the page, the syntax to import it into your C# application is specified there).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote:
You want it globally or with context to your application only? To find find it globally, you can use GetCursorPos()[^]. It is a Windows API function and you will need to import user32.dll to use it. (Just scroll down to the bottom of the page, the syntax to import it into your C# application is specified there).
Or if he's using WinForms, he can just use Cursor.Position (which internally calls GetCursorPos).
|
|
|
|
|
Thanks for your comments, Nish.
There's way too less information provided (it isn't clear what he's using or not), so I just wanted to help the poor OP (who had received no replies that can help him until then) with an answer that would work for sure. May not be the simplest answer though.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: There's way too less information provided (it isn't clear what he's using or not), so I just wanted to help the poor OP (who had received no replies that can help him until then) with an answer that would work for sure. May not be the simplest answer though.
I thought your answer was very good. And the previous answers he got were all fairly useless.
Btw, I got linked here from the Lounge thread.
|
|
|
|
|
when i start thread it displays "thread is not started"
some times nothing is diplayed nothing is happening
can anyone help....
code is like this
class class1
{
class2 obj=new class2();
thre=new thread(new threadstart(obj.run));
}
class class2
{
public void run()
{
}
}
what can be the problem
This code was posted by me...
|
|
|
|
|
Does that even compiles? I believe it should not. Read a book or the MSDN documentation for Thread.
|
|
|
|
|
I am transitioning from the mainframe to C#. I have so far been able to build an XML doc containing a multi-column table.
I have been able to create the code to read that back in, but I can't figure out how to populate some sort of multi-columned collection or whatever that would contain rows of multi-column data that mirrored the XML table contents.
HELP!!!! and THANKS!!!
|
|
|
|
|
Go for DataGridView. Create a Dataset using your XML and ReadXML method and assign it as DataSource for your DataGridView.
|
|
|
|
|
what's mean the <> command in the next line :
List<item>
{
...
}
|
|
|
|
|
First off, two bits to make it easier on us all.
1) Use the "code block" button above, even for small examples.
2) Just above the "Post Messaeg" button is a box marked "Encode HTML tags when pasting" this means that < and > are displayed corretly, with any contents.
So, I assume what you meant was:
What's does the <T> mean in a List<T>?
A old fashioned List can hold any type of object, so you could use:
List list = new List();
list.Add(new TextBox());
list.Add(123);
list.Add("Hello");
without complaint, if you meant to or not.
When you came to use list though, you would have to check what type of object you had, or a run time error would occur.
Newer versions are type safe - you can only include the declared type:
List<TextBox> list = new List<TextBox>();
list.Add(new TextBox());
list.Add(123);
list.Add("Hello");
would give compiler errors for the integer and string.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
modified on Saturday, July 11, 2009 5:20 AM
|
|
|
|
|
I have the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://none.none.none/webservices">
<TREENODES xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<TREENODE code="1" text="None" >
<TREENODE code="2" text="America" >
<TREENODE code="16128" text="AUTOS">
<TREENODE code="ATO" text="ATO" />
<TREENODE code="ATO" text="ATO" />
</TREENODE>
</TREENODE>
</TREENODE>
<TREENODE code="11" text="None" >
<TREENODE code="21" text="America" >
<TREENODE code="3" text="AUTOS">
<TREENODE code="ATO44" text="ATO5" />
</TREENODE>
</TREENODE>
</TREENODE>
</TREENODES>
</string>
And this code to read the xml into class Hierarchy.
void client_ReadCompleted(object sender, ReadCompletedEventArgs e) {
if (e.Error == null) {
string s = e.Result.ToString();
XDocument document = XDocument.Parse(s);
var retVal = (from treeNode in document.Descendants("TREENODE")
select new Hierarchy() {
Code = treeNode.Attribute("code").Value,
Text = treeNode.Attribute("text").Value,
}).FirstOrDefault();
retVal.Hierarchies = GetHierarchy((from treeNode
in document.Descendants("TREENODES")
select treeNode).FirstOrDefault());
Hierarchies = retVal.Hierarchies;
}
}
public static List<Hierarchy> GetHierarchy(XContainer root) {
List<Hierarchy> retVal = new List<Hierarchy>();
var children = from treenode in root.Descendants("TREENODE")
select treenode;
foreach (var treenode in children) {
Hierarchy node = new Hierarchy();
node.Code = treenode.Attribute("code").Value;
node.Text = treenode.Attribute("text").Value;
node.Hierarchies = GetHierarchy(treenode);
retVal.Add(node);
}
return retVal;
}
public class Hierarchy {
public string Code { get; set; }
public string Text { get; set; }
public List<Hierarchy> Hierarchies { get; set; }
public Hierarchy() {
Hierarchies = new List<Hierarchy>();
}
}
However my construction/population of the class is not the same as the XML. I can not see the error.
|
|
|
|
|
FYI: I should have done
public static List<Hierarchy> GetHierarchy(XContainer root) {
List<Hierarchy> retVal = new List<Hierarchy>();
var children = from treenode in root.Descendants("TREENODE")
select treenode;
foreach (XNode xn in root.Nodes()) {
Hierarchy node = new Hierarchy();
node.Code = ((XElement)xn).Attribute("code").Value.ToString();
node.Text = ((XElement)xn).Attribute("text").Value.ToString();
retVal.Add(node);
node.Hierarchies = GetHierarchy((XContainer)xn);
}
return retVal;
}
|
|
|
|
|
Hi all,
I'm having trouble suppressing mouse clicks globally. There are a lot of articles about how to connect to mouse and keyboard hooks and how to suppress a keypress but how would you stop, say, a right click in Windows?
Thanks in advance.
|
|
|
|
|
Stop a right click where?
If it's your application just don't handle the event.
only two letters away from being an asset
|
|
|
|
|
to allow your application to prevent a right click being actioned in Windows by using your application as a form of mouse hook that doesn't pass on any right clicks to any other applications/windows
|
|
|
|
|
Have you tried looking here[^]?
only two letters away from being an asset
|
|
|
|
|
thanks for the reply. Yeah I have read that article but I can't work out how to prevent the mouse click event being passed on to other windows. With the keys you can just set the e.handled=true but there doesn't appear to be a similar thing for the mouse.
|
|
|
|
|
Hello, i need help in some subject i can't handle with for few days. lets say i have form that handle with some rent order (like....billiboards) after the user choose the number of the billboard and the Location and everything else, he need to choose 2 dates. one for the publish day and one for the getOFF day. i have odbc database that hold all the information about the billboards etc... how can i make some "if" or queries that will check that this billboard is not ordered in that range of days? for now i only have the insert handle. PLEASE HELP.
in abstract way = the code have to check the "signNumber" too not only the range between dates. in ABSTRACT = "take the signNumber and check if is available between that two dates if yes, insert to the database if not throw messagebox - NOT AVAILABLE"
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Data.Odbc;<br />
<br />
namespace forumArt<br />
{<br />
public partial class addNewCampaign : Form<br />
{<br />
public addNewCampaign()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void addNewCampaign_Load(object sender, EventArgs e)<br />
{<br />
this.customersTableAdapter.Fill(this.dataSet1.customers);<br />
this.signsDetailsTableAdapter.Fill(this.dataSet1.signsDetails);<br />
<br />
}<br />
<br />
private void button2_Click(object sender, EventArgs e)<br />
{<br />
Close();<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
if (signNumber.Text == "")<br />
{<br />
MessageBox.Show("חובה לבחור את מספר השלט");<br />
}<br />
if (companyName.Text == "")<br />
{<br />
MessageBox.Show("נא לבחור את שם החברה המזמינה");<br />
}<br />
else<br />
{<br />
try<br />
{<br />
OdbcConnection conn = new OdbcConnection("dsn=forumArtDataBase");<br />
OdbcCommand cmd = new OdbcCommand("insert into orders(signNumber,fromDate,toDate,companyName,comments) values ('" + signNumber.Text + "','" + fromDate.Text + "','" + toDate.Text + "','" + companyName.Text + "','" + comments.Text + "')", conn);<br />
conn.Open();<br />
cmd.ExecuteNonQuery();<br />
conn.Close();<br />
MessageBox.Show("ההזמנה התווספה בהצלחה");<br />
Close();<br />
}<br />
catch (OdbcException ex)<br />
{<br />
<br />
MessageBox.Show("התבצעה שגיאה בעת ניסיון ההתחברות למסד הנתונים" + ex);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
|
|
|
|
|
First, stop using string concatenation to form your sql statements. There has been enough written about how poor this is, for number of reasons, that you should have seen something about it. Use a stored procedure.
SQL
IF( NOT EXISTS(SELECT signNumber FROM orders WHERE Date BETWEEN start AND end))
INSERT...
RETURN 1
ELSE
RETURN 0
Code
if( SQLCommand.ExecuteScalar() == 0 )
display mbox
only two letters away from being an asset
|
|
|
|
|
In general terms what you need to do is the following.
Get the signNumber, Start Date, End Date and Company Name (needed for insert later) from the user.
Pass the signNumber, Start Date and End Date as parameters to an SQL select statement which does the following:
<big>Select</big> whichever fields you want from the orders table <big>where</big> orders.signNumber == the one passed as a parameter
and ((the Start Date passed as a parameter is <big>between</big> orders.fromDate and orders.toDate)
or (the End Date passed as a parameter is <big>between</big> orders.fromDate and orders.toDate))
If the Select statement returns any rows the sign is already booked for at least part of the required period.
If, on the other hand no rows are returned, then the board is free to be used.
The highlighting provides some clues to things that you will need to research in order to do this.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Is there a way to know whether windows is doing a Restart OR a Shut Down?
I mean by any means in the world?
It's easy to catch the WM_ENDSESSION message but it regroups these both modes.
Also is there a way to do the same thing but with Stand By and Hibernate??
I can't and won't believe there is no way whatsoever to do this.
It's another of these things that seems ridiculously easy but turn out to be an hardcore nightmare when you attempt it.
Thanks
Olograph
|
|
|
|