|
anyone knows the function for checking if the system had been idle for a specified amount of time, i.e., the user had not performed any action for n seconds. tnx for helping me out!
vicky
|
|
|
|
|
Have a look at http://www.codeproject.com/csharp/uim.asp.
|
|
|
|
|
Hi,
I had made one user control and i am adding this user control into one win form.Now problem is that whenever i am drawing any rectangle on the control which is on the form the images goes down side,which looks very bad.
if i will put autoscroll=false then when image is larger then required size then user will not able to see whole image.
so what is the way can any one help me?
thanks
regards.,
montu3377
|
|
|
|
|
how do u draw the image as abackgroung image
or at all write the code tthat u used to do it
ByMindOnlyYouCanDoIt
|
|
|
|
|
> whenever i am drawing any rectangle on the control which is on the form the images goes down side
Please explain what "down side" means. I don't exactly understand the problem.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi,
Yeah down side means that my image is scrolled bottom side of the screen.The whole scenerio is that whenever i draw a Rectangle on that image,vertical scrollbar is gone slightly down and due to that whole image gone down or say bottom side.
this is main problem.
regards.,
montu3377
|
|
|
|
|
Hello,
I am using a datagrid and l have update and delete, based on what the user clicked on.
Double click - display a form and with the details of the row what was double clicked to be able to update the customer.
Single click - click once on the row and then press a button to delete this customer.
My problem is, when l have these 2 events, it always goes into the single click event, wheather l double click the grid or single click the grid.
The code that l have to be able to update and delete works fine. But l can't do my update as the double click will always execute the single click event and not go into the double click. I have tried using mouse down event but that does not work either.
Is there way round this problem.
Many thanks in advance,
Steve
|
|
|
|
|
|
Hello Every one first of all wish u happy new year to all code project partners.any way at the movement i'm in analyzing phase of web base project management system.which is going to develop using c#.
i'm looking gantt chart design control for this Asp dot net projet.can any one help me to develop a this kind of control or provide me a source code so i can customize it according to my requirement.
Thanks
Amael
|
|
|
|
|
any gantt charts for datagrid's available to customise ??
|
|
|
|
|
I have a checkbox that if checked, textBox1 gets enabled (texBox1.Enable=true) if uncheck it textBox1 gets disable.
I did this using another textBox to store the state and then compare. Is there an simple way to do this?
appreciate any help
|
|
|
|
|
Yes. The simple way is not to have the other textbox that stores the state. Since the checkbox control has a Checked property, what would you be storing in that other textbox? Let's see the code.
Matt Gerrans
|
|
|
|
|
It's this simple:
void CheckBox1_CheckedChanged()
{
txtBox1.Enabled = CheckBox1.Checked;
} Check the event name, but it's something like that.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Its because i'm making a list control from scratch (a REAL list control, extends nothing more then System.Windows.Forms.Control)...and i'm looking for info to tell me what iterfaces my collection should implement...what should i extend...(i extended collectionbase, but some of the controls i seen just implement interfaces).
I already made a collection that works with designer, but i have no idea if its a good collection and i want the control to have a good foundation.
p.s. know of any other opensource truely custom(not extending any list control), besides glacialList?
|
|
|
|
|
I wrote one that does not extend the ListView
http://www.codeproject.com/cs/miscctrl/vivantlist.asp
However, I would suggest you wait until I publish the rewrite. I have a post about version 3.0 on the page. I am currently using it in a project, so it is basically done. I just need to clean it up and write an article on how to use it. So far results are good, on my 1 GHz machine; it can load 100,000 items in 18 seconds, and 10,000 in under a second, where each item has two controls in it. On a 1.4 GHz, it has done 100,000 in 8 seconds.
I dissected the Shape Library example published by Microsoft many times to get a control designer working on a component. I would recommend if you want to learn more on the subject of controls, you take a good look at the Shape Library.
http://windowsforms.net/articles/shapedesigner.aspx
|
|
|
|
|
Thx for links...that m$ thing looks to have alot of good stuff inside.
|
|
|
|
|
I am a newbie to C# so please excuse if this problem is really something simple.
I am trying to create an app that sets a window to maximized state after it recieves a certain command over a TCP port. I can get the tcp listener to work but I cant get the form to display. The form never even shows up. I only get the runtime error "Object reference not set to an instance of an object" after I enter the command via the network to set the form to maximized. I think the problem has to do with my calling a method from within the constructor when the constructor has not yet finished. I have attached my code if anyone is willing to look and suggest where I might find where I am going wrong.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
namespace networkScreenBlanker
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.Run();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
}
#endregion
private void Run()
{
IPAddress localAddr = IPAddress.Parse("127.0.0.1");
TcpListener tcpListener = new TcpListener(localAddr, 65000);
tcpListener.Start();
for(;;)
{
Socket socketForClient = tcpListener.AcceptSocket();
if (socketForClient.Connected)
{
//Console.WriteLine("Client connected");
//SendFileToClient(socketForClient);
NetworkStream networkStream = new NetworkStream(socketForClient);
System.IO.StreamReader streamReader = new System.IO.StreamReader(networkStream);
string inputString;
inputString = streamReader.ReadLine();
if (inputString != null)
{
if (inputString == "blankScreen")
{
Form1.ActiveForm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
//Console.WriteLine("Disconnecting from client...");
socketForClient.Close();
//Console.WriteLine("Exiting...");
break;
}
}
}
}
//[STAThread]
public static void Main()
{
Application.Run(new Form1());
}
}
}
|
|
|
|
|
Yes you are correct. The code is halting within Form1.Run() (called from the constructor) so execution never reaches Application.Run(new Form1()), which is the reason you never see the form open.
To acheive the result you require can be acheived by running the Form1.Run() method as a seperate worker thread which can be achieved something like:-
public class Form1 : System.Windows.Forms.Form
{
private Thread trdTcpActivityListener = null;
public Form1()
{
InitializeComponent();
trdTcpActivityListener = new Thread(new ThreadStart(this.Run));
trdTcpActivityListener.Start();
}
public void Run()
{
TcpListener tcpListener = new TcpListener(IPAddress.Any, 65000);
tcpListener.Start();
while (true)
{
if (tcpListener.Pending())
{
Socket socketForClient = tcpListener.AcceptSocket();
socketForClient.Close();
this.WindowState = FormWindowState.Maximized;
}
Thread.Sleep(30);
}
}
}
Now whilst the worker thread waits for a TCP connection, the main thread is allowed to continue,
the constructor completes and the form opens (minimized). Ill leave it up to you to work out when you should stop the worker thread.
|
|
|
|
|
Thanks for the suggestion. This worked. Now to read that chapter on threading.....
Jackson
|
|
|
|
|
I have a Windows Forms app, with two listviews, separated by a splitter control. Both listviews have vertical scrollbars. I want to make sure that if the user moves the scrollbar in either of the listviews, the other scrollbar should also move.
Any ideas?
Thanks a lot in advance.
-KMAnsari
|
|
|
|
|
Hi there,
I'm trying to consume a web-service that is supposed to return a
collection of a custom object. The web-service was not created with C# or
VS.net. It was created with IBM VisualAge Smalltalk 6. I haven't had
problems consuming other web-services but c# seems to choke with
"Collection" return types. The collection (or array) is supposed to
contain three instances of a custom object called PsmWsResult, which has
two variable members: code, and description.
If you'd like to try to see an example of this problem you can add the
following web-reference to your project:
http://216.18.68.93:9999/CollectionWsInterface.wsdl
(The browser window will say that there are no functions found, but they
are there)
After adding the web-reference and renaming it "CollectionsTest", I
created a plain vanilla windows app and inserted the following into the
form load event:
CollectionsTest.CollectionWsInterface ws =
new CollectionsTest.CollectionWsInterface();
//PsmWsCollection seems to be the return object
//which is supposed to be a collection.
CollectionsTest.PsmWsCollection wsCollection;
wsCollection = ws.getCollection();
At this point, the debugger halts execution here:
"CollectionsTest\Reference.cs"
-------------------------------
[System.Web.Services.Protocols.SoapRpcMethodAttribute
("http://www.CollectionWsInterface.com/CollectionWsInterface-
interface/getCollectio" +
"n", RequestNamespace="urn:CollectionWsInterface",
ResponseNamespace="urn:CollectionWsInterface")]
[return: System.Xml.Serialization.SoapElementAttribute("outMsgText")]
public PsmWsCollection getCollection() {
//debugger breaks at the following line!
object[] results = this.Invoke("getCollection", new object[0]);
return ((PsmWsCollection)(results[0]));
}
-------------------------------
The first lines of the stack trace:
-------------------------------
Unhandled Exception: System.InvalidOperationException: There is an error
in XML document (16, 14). ---> System.InvalidCastException: Cannot assign
object of type WindowsApplication3.CollectionsTest.PsmWsResult to an
object of type WindowsApplication3.CollectionsTest.PsmWsResult[].
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Rea
d1_PsmWsCollection()
-------------------------------
Which leads me to believe that the collection is being returned as an
array itself. I'm stuck at this point, how do I cast the return type to
be an array of itself??
If I try the following:
wsCollection = (CollectionsTest.PsmWsCollection[])ws.getCollection();
I get a "Cannot convert type" error when compiling.
I tried invoking the getCollection function using "Web Service Studio"
and it chokes on it as well!
If anyone has any clue on what I should do to correct this, I'd
appreciate it!
Thanks!
Jorge
|
|
|
|
|
Unfortunately, I can't pull up your WSDL file to see what datatypes it is using. It looks like the XML being returned does not match the XML Schema defined in the WSDL file.
To start looking into this, click the show all files icon in the project viewer and expand the web reference until you see the reference.cs file. You should be able to see the data types that the method is returning.
Get a tool like httpLook[^] and look at the XML that is actually being sent. There should be a very simple correspondence between the return types and the XML.
If not then the WSDL does not match the data being sent and you are probably going to need to learn more about XML Schema then you ever wanted to know to sort the problem out. Comparing the generated types and the actual data should get you started in the right direction though.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Hi all ,,, a have an exception message when i try to create a TcpClient in win socket says : lack of memory or queue is full .
iI am using winXP Pro , C#, port no > 1024 ( is it OK ?) , and on toshiba laptop.
what is the solution please .
Thanks to you all
|
|
|
|
|
From the information you have given us we can't help you much.
Well I guess you "ran out of memory or your queue is full". This is mostly like a debugging task you'll have to do on your own... check all your code.
Also, please dont post same thing twice.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Getting the inner exceptions can help understand the problem sometimes. Could you post the inner exception messages?
try
{
// ... do whatever ....
}
catch (Exception ex)
{
Console.WriteLine (ex.Message);
Exception innerEx = ex.InnerException;
while (innerEx != null)
{
Console.WriteLine (ex.Message);
innerEx = innerEx.InnerException;
}
}
|
|
|
|