|
sherifffruitfly wrote: a pane for a treeview
Why not simply load the whole XML document into the TreeView?
|
|
|
|
|
No major reason - I just think of treeview data situations a 2-paned affairs is all. Possibly that's an out-moded frame of mind.
I was more interested in alternative methods of getting the data to the app in the first place though, I can fiddle with it once it's there in a variety of ways.
|
|
|
|
|
Hello, I do not know why it is happening, but sometimes DateTime.Substract returns either 0 or 1, while parameter have same values
public bool bCodeChange1;
public bool bCodeChange2;
private DateTime RemoveTime(DateTime time)
{
time = time.AddHours(-time.Hour);
time = time.AddMilliseconds(-time.Millisecond);
time = time.AddMinutes(-time.Minute);
time = time.AddSeconds(-time.Second);
return time;
}
private void dateTimePickerDateDeadLine_ValueChanged(object sender, EventArgs e)
{
DateTime dtDateDeadLine = dateTimePickerDateDeadLine.Value;
DateTime dtDateReciet = dateTimePickerDateReciet.Value;
dtDateDeadLine = RemoveTime(dtDateDeadLine );
dtDateReciet = RemoveTime(dtDateReciet );
if (dtDateRecit >= dtDateDeadLine )
{
MessageBox.Show("DeadLine need to be at least one day ahead of Reciet", "Račun", MessageBoxButtons.OK);
dateTimePickerDateDeadLine.Value = dtDateReciet.AddDays(1);
return;
}
if (bCodeChange2)
{
bCodeChange2 = false;
return;
}
bCodeChange1 = true;
numericUpDownDaysTillDeadLine.Value = dtDateDeadLine.Subtract(dtDateReciet).Days + 1;
}
private void numericUpDownDaysTillDeadLine_ValueChanged(object sender, EventArgs e)
{
if (bCodeChange1)
{
bCodeChange1 = false;
return;
}
bCodeChange2 = true;
numericUpDownDaysTillDeadLine.Value = dateTimePickerDateReciet.Value.AddDays(Convert.ToDouble(numericUpDownDaysTillDeadLine.Value));
}
I am so puzzled. Thanks goes in Advance.
PS: If variables names missmatches, you do not need to point out, because i nearly translated variable names, so that you can understand.
|
|
|
|
|
Saksida Bojan wrote: numericUpDownDaysTillDeadLine.Value = dtDateDeadLine.Subtract(dtDateReciet).Days + 1;
In your example above this should return zero, as the Subtract() method returns -1; dtDateDeadLine is smaller (i.e. less than) dtDateReciet . If the dates are equal then Subtract() will return zero giving a final answer of 1.
|
|
|
|
|
Saksida Bojan wrote: i nearly translated variable names
not a good idea in general
One problem you have is DateTime contains time up to a single tick, that's a tenth of a microsecond.
To strip the time, just use DateTime.Date
In general, when in trouble with a particular class, read the first 3 MSDN pages about that class, including the list of methods, properties and events.
|
|
|
|
|
Thank you, it worked like a charm.
|
|
|
|
|
you're welcome.
|
|
|
|
|
Good afternoon.
I was wondering if there is a more efficient way to write this code:
if (cboSP_Site.SelectedIndex == -1 && inttmpSP != -1)
{
WebBrowser1.GoBack();
}
else if (cboWS.SelectedIndex == -1 && inttmpWS != -1)
{
WebBrowser1.GoBack();
}
else if (cboFolder.SelectedIndex == -1 && inttmpF != -1)
{
WebBrowser1.GoBack();
}
I want to call the WebBrowser1.GoBack(); once if possible.
Thank you, WHEELS
|
|
|
|
|
Wheels012 wrote:
I want to call the WebBrowser1.GoBack(); once if possible.
Do nested If
if (cboSP_Site.SelectedIndex == -1)
{
if (inttmSP != -1 || inttmpWS != -1 || inttmpF != -1)
WebBrowser1.GoBack();
}
I hope i did it correctly
|
|
|
|
|
Saksida Bojan wrote: I hope i did it correctly
Not really. Every letter counts here.
|
|
|
|
|
there are many ways to get what you want, here is one:
if ((cboSP_Site.SelectedIndex == -1 && inttmpSP != -1) ||
(cboWS.SelectedIndex == -1 && inttmpWS != -1) ||
(cboFolder.SelectedIndex == -1 && inttmpF != -1)) {
WebBrowser1.GoBack();
}
and another one:
bool goBack=false;
if (cboSP_Site.SelectedIndex == -1 && inttmpSP != -1) goBack=true;
else if (cboWS.SelectedIndex == -1 && inttmpWS != -1) goBack=true;
else if (cboFolder.SelectedIndex == -1 && inttmpF != -1)) goBack=true;
if (goBack) WebBrowser1.GoBack();
BTW: here the "else" keywords are optional
modified on Monday, November 30, 2009 4:23 PM
|
|
|
|
|
Thank you Luc.
if ((cboSP_Site.SelectedIndex == -1 && inttmpSP != -1) ||
(cboWS.SelectedIndex == -1 && inttmpWS != -1) ||
(cboFolder.SelectedIndex == -1 && inttmpF != -1)) {
WebBrowser1.GoBack();
}
Is what I am looking for. A little slow today.
WHEELS
|
|
|
|
|
5 years from now, you'll probably be scratching your head over what this code does. At the risk of being chastised for writing more code, I suggest you amend the code to:
bool itemDeleted = (cboSP_Site.SelectedIndex == -1 && inttmpSP != -1) ||
(cboWS.SelectedIndex == -1 && inttmpWS != -1) ||
(cboFolder.SelectedIndex == -1 && inttmpF != -1);
if (itemDeleted) {
WebBrowser1.GoBack();
} /ravi
|
|
|
|
|
|
that's why I offered some alternatives, you pick whichever you like most.
|
|
|
|
|
Thank you ravi. Good code. WHEELS
|
|
|
|
|
Is there a split container control that will allow the user the ability to resize the control during the applications runtime environment. And will allow for more than 2 split panels. As the SplitContainer control I can only see it allowing 2 containers. I need at least 3 or 4 containers to be resizable. Without having to next the containers inside each other.
|
|
|
|
|
AFAIK nesting SplitContainers is the normal approach.
The alternative could be a TableLayoutPanel, but then IMO you have to organize the resizing handles and everything yourself.
|
|
|
|
|
Thanks, That is what I figured .. As that was the only way I could get it to work and drop the margins to maximize used space.
Quick question though... On this control how to you fix 1 of the partitions sizes to a minimum size. Here is what I tried but it is not working.
if (scRPTFilter1.Panel2.Height != 275)
{
scRPTFilter1.Panel2.Height = 275;
}
if (scRPTFilter1.Panel2.Width != 557)
{
scRPTFilter1.Panel2.Width = 557;
}
I was thinking I needed to say something like
if (scRPTFilter1.Panel2.Height != 275)
{
scRPTFilter1.Panel2.Height = new size(275, scrptfilter1.panel2.width);
}
Just Not Sure since the height is separated here.
|
|
|
|
|
Hi,
1.
Control.Height and Control.Width are existing properties, you can get and set them.
Control.Size is also a property, you can get and set it, however setting it requires a new Size, it does not make sense to set either Control.Size.Height or Control.Size.Width, since that will change the H or W of the copied size, not the Control's actual Size.
2.
I haven't done such things with SplitContainer (I used it only once), it probably works just fine.
3.
If you want to enforce a minimum W or H, you should test for < and not for equality, otherwise you can't change it at all.
|
|
|
|
|
I just need to know how to enforce 1 panel's minimum size.
|
|
|
|
|
well, try if (pan.Width<minWidth) pan.Width=minWidth; and similar for height inside its Resize, SplitterMoving and/or SplitterMoved handler. And/or read up on those events.
|
|
|
|
|
Hi,
A colleague and I came across this same problem and made a control derived from TableLayoutPanel , implementing the MouseDown , MouseMove and MouseUp events. It works reasonably well, except for designer support - we have to add all the controls via code.
Dybs
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
Hi friends,
I need to fix a part of .cs code and recompile and publish a project into production, but when i build it, it shows below error: can anyone give me some suggestion? what might be the cause? do I need to check my development environment? many thanks...
------ Build started: Project: Z:\scor_ip\, Configuration: Debug .NET ------
Pre-compiling Web Site
Z:\scor_ip\Global.asax(1): Publication (web): Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Pre-compilation Complete
------ Skipped Publish: Project Z:\scor_ip\, Configuration: Debug .NET ------
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
========== Publish: 0 succeeded, 0 failed, 1 skipped ==========
|
|
|
|
|
Suggestion 0: Next time give your question a more useful subject.
Suggestion 1: Questions like this are more likely to get better answers on the ASP .Net forum.
In answer to your question:
alexyxj wrote: Request for the permission of type 'System.Web.AspNetHostingPermission
This means exactly what it says: You don't have permission to host an ASP .Net website. This often means you are trying to run the website from an untrusted location.
The drive letter Z suggests you might be trying to run it off of a mapped network drive. These are usualy untrusted locations. Try copying the whole project to somewhere on your local hard drive and trying again.
|
|
|
|