|
I don't use the Telerik Treeview (I use one from Lidor Systems), so I don't know exactly what special features ... compared to any other Control ... it offers, or the exact syntax of Events it exposes, but this is pretty simple to do.
The Microsoft TreeView does not, of course, offer multiple selection, but the following code for the MS TreeView will demonstrate a general solution:
TreeNode firstSelectedNode;
TreeNode firstSelectedNodeParent;
private void treeView1_BeforeSelect(object sender, TreeViewCancelEventArgs e)
{
if (firstSelectedNode == null)
{
firstSelectedNode = e.Node;
firstSelectedNodeParent = firstSelectedNode.Parent;
}
else
{
if (e.Node.Parent != firstSelectedNodeParent) e.Cancel = true;
}
}
This code will confine selection to the sibling nodes of the first selected TreeNode. Obviously, in real-world use, you will need to reset the variable 'firstSelectedNode to null after you have "handled" the current selection.
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
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;
namespace WindowsFormsApplication7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
DateTime[] start = new DateTime[] { new DateTime(2000, 1, 1), new DateTime(2004, 1, 1),
new DateTime(2004, 1, 1), new DateTime(2008, 1, 1) };
DateTime[] end = new DateTime[] { new DateTime(2002, 1, 1), new DateTime(2006, 1, 1),
new DateTime(2006, 1, 1), new DateTime(2010, 1, 1) };
int timeDifference = 0;
TimeSpan timespan;
private void button1_Click(object sender, EventArgs e)
{
for (int i=0; i<end.Length-2; i++)
{
if (end[i] < end[i + 1] && start[i] <start[i +="" 1]="" &&="" start[i="" 1]<="end[i])
" {
="" timespan="(end[i]" -="" start[i])="" (end[i="" end[i]);
="" }
="" if="" (end[i]="">= end[i + 1] && start[i] <= start[i + 1])
{
timespan = (end[i] - start[i]);
}
if (end[i] > end[i + 1] && start[i] > start[i + 1] && start[i] <= end[i + 1])
{
timespan = (end[i] - start[i]) + (end[i + 1] - end[i]);
}
if (end[i] <= end[i + 1] && start[i] >= start[i + 1])
{ timespan = (end[i + 1] - start[i + 1]);
}
timeDifference = timespan.Days + timeDifference;
}
MessageBox.Show(timeDifference.ToString());
}
}
}
|
|
|
|
|
What is the question?
Veni, vidi, abiit domum
|
|
|
|
|
i should find the length of days in the array but in my code |--- Date 1 ---|
|--- Date 2 ---| dont calculate in right way
|--- Date 1 ---|
| --- Date 2 --- |
| --- Date 1 --- |
| --- Date 2 ---- |
| -------- Date 1 -------- |
| --- Date 2 --- |
| --- Date 1 --- |
| -------- Date 2 -------- |
|--- Date 1 ---|
|--- Date 2 ---|
| --- Date 2 --- |
| --- Date 1 ----|
| --- Date 1 --- |
| -------- Date 2 -------- |
| --- Date 1 --- |
| --- Date 2 --- |
|
|
|
|
|
i should find the length of days in the array but in my code |--- Date 1 ---|
|--- Date 2 ---| dont calculate in right way
|
|
|
|
|
I have no idea what all these pictures are supposed to mean, please try explaining your problem in better detail.
Veni, vidi, abiit domum
|
|
|
|
|
ok i will explain in this way you worked from
DateTime[] start = new DateTime[] { new DateTime(2000, 1, 1), new DateTime(2004, 1, 1), new DateTime(2004, 1, 1), new DateTime(2008, 1, 1) };
to
DateTime[] end = new DateTime[] { new DateTime(2002, 1, 1), new DateTime(2006, 1, 1), new DateTime(2006, 1, 1), new DateTime(2010, 1, 1) };
and find how long you worked from 200years to 2010? as you see here i have overlap datetime and when i calculate in my program the lenght of working days i found it is not true
did you understand now?
|
|
|
|
|
if (end[i] < end[i + 1] && start[i] = end[i + 1] && start[i] <= start[i + 1])
should be
if (end[i] < end[i + 1] && start[i] == end[i + 1] && start[i] <= start[i + 1])
Veni, vidi, abiit domum
|
|
|
|
|
|
[twitchy left eye typing mode]
if (end[i] < end[i + 1] && start[i] == end[i + 1] && start[i] <= start[i + 1])
There is a difference between = and == in C#...
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
hi Guys....
i have a programm and its about Human Resource managment...(c# and linq)
My Problem is :
i have 2 form ...: frmPersonals.cs and frmRPersonals.cs
the first one( frmPersonals) is for input data and save it to DB. and as you will see there is an image box in it(image of person will be save and retrieve on it)
the second form(frmRPersonals) is for search the DB (filter by user request).and it search Db and use "report Viewer" to show it.
my request is here:
i want to add the same image box (like first form) and put it in my Second form(frmRPersonals)so when it find the proper person it show his-her picture in this form...(in other word i want code that do the same things in my first form means:retreive the image of filtered personT in image box that will be put in frmRPersonals)...
how can i do that...plz do this for me in my source code....god bless u!
i will upload my whole source code ....plz help me i need it.
<a href="http://www.mediafire.com/download/7q00kqzg794mp9h/Personals-Info.zip">http://www.mediafire.com/download/7q00kqzg794mp9h/Personals-Info.zip</a>[<a
href="http://www.mediafire.com/download/7q00kqzg794mp9h/Personals-Info.zip" target="_blank" title="New Window">^</a>]
|
|
|
|
|
I suggest you read the guidelines on how to ask a question. Good luck with your homework.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Store the image in the database along with the rest of the person's details. There are plenty of samples around that show how to do it.
BTW no one is going to download your source code and rework it for you.
Veni, vidi, abiit domum
|
|
|
|
|
1. Your post is against about every rule in the guideline. Please read them first. (first forum post on top)
2. Don't provide download links like that, we don't know you and don't trust strangers.
3. Don't do txt spch. They're is an entire dictionary at your disposal, use full sentences and full words. It is a token of respect for one another.
4. No one will fix things for you. We will help you with a specific problem so you can fix it yourself. If you need coding done for you there are other sites for that.
5. "god bless u" Suppose, for a brief moment, I believe in such an entity, why would he bless me and what gives you the power or the right to make that claim for said entity? (OK, here I'm joking, but keep "faith" related expressions out posts, unless it is in the soapbox)
Despite the replies you received so far, no one is "against" you, nor is it personal, just step in line with the forum's way of working and you 'll be just fine.
|
|
|
|
|
I want to run a command in remote computer command prompt and fetch command output of the remote computer and save the output in local system. i don't want to use WMI for this as wmi is not enabled in the remote computer.
|
|
|
|
|
|
i have already mentioned wmi is not an option.
|
|
|
|
|
|
If I were you, I'd use PsExec[^] to execute the commands.
|
|
|
|
|
can psexec work for machines not in domain.
|
|
|
|
|
Do you think of a tool similar to Java's Web Start used by e.g. Continuous Integration tools like Hudson and Jenkins?
Well, I do not know of such a component in the .Net world...
|
|
|
|
|
can i execute command in a windows box remotely over internet and get its output provided i have full details of credential required to connect to the remote machine. Through PSexec i am able excute command in remote machine in the LAN /intranet and get output in my local machine in a text file but will it be possible to get the same details if the remote machine is connected in Internet.
|
|
|
|
|
Assuming you have the credentials and legal approval then the pc must be directly connected to the internet, meaning it must have an ip directly on the internet, or have port forwarding enabled on the router it sits behind.
Normally you are not going to find pc's directly attached to the internet. Best practice is a firewall in between, which means you need to manually set up port forwarding at the pc's location.
|
|
|
|
|
Lets start with the basics first.
To execute a 'command' on a remote machine then the remote machine MUST have a server application running which will execute those commands. (Note that starting an application is also considered executing a command so you cannot expect to remotely start the application.)
And that server application MUST be remotely accessible.
That is an absolute. There is no other possibility.
There are many applications that can do this - including writing your own.
The FIRST step to implementing a solution is to determine what that server application will be. Because that will determine what the client application can do and what it can't do.
|
|
|
|
|
Hi I am just starting out using c# and I have followed a tutorial i think but i am getting errors
------------------------------------------------
namespace SkiTrip
{
Class Student
{
private string name;
private decimal totalPaid;
private bool canTravel;
//Here write the properties
public void setName (string newName)
{
name = newName;
}
public string getName ()
{
return name;
}
}
--------------------------------------------
Error 1 A namespace cannot directly contain members such as fields or methods
Error 2 x 4 Expected class, delegate, enum, interface, or struct
--------------------------------------------
help really appreciated
mark
|
|
|
|
|