|
When I add a TreeView control to a form and then run the program, a horizontal scrollbar appears at the bottom of the control, whether needed or not. How can a remove this unnessary scrollbar?
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Change the Scrollable property to false.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
I would do what you recommended, however, I want the scrollbars to show up when they are necessary. Is there some workaround for this situation?
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
bneacetp wrote:
I want the scrollbars to show up when they are necessary
Ok, I see now.
bneacetp wrote:
is there some workaround for this situation?
I've never seen one, but I would either cheat, and say if the treeview has 3 embedded nodes, change the scrollable property to true, or do it the hard way and measure the nodes to see if you truely need to scroll.
Hope this gives you some idea's
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
Aaron Eldreth wrote:
or do it the hard way and measure the nodes to see if you truely need to scroll.
It kind of looks like I may have to do things the hard way you mentioned, although it would be nice if there way some quicker way around this. Thanks for the help.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Hello friends,
I have two problems that I need help as soon as possible:
1. How can I dial and stablish a dial-up connection from within my ASP.NET application?
2. How can I call a webservice method at runtime using its name and address as strings?
Waiting for fast helps,
I thank you so much.
- den2fly
---
"Art happens when you least expect it."
|
|
|
|
|
Den2Fly wrote:
How can I dial and stablish a dial-up connection from within my ASP.NET application?
Why would you want to?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Well, I need to dial a machine and hang-up so it calls back and connects to internet.
---
"Art happens when you least expect it."
|
|
|
|
|
From an ASP page? Is this a server running a an FTP or web site?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You might be able to get away with it, but by the time the machine calls back and gets connected to the net your ASP.NET page and/or browser will have long since timed out.
If your are remotely waking a machine up and having connect to the Internet, is it using a standard ISP service? If so, then the machine will receive a different IP address every time and will be incredibly slow for a server, so what good is the remote machine??
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am wanting to add functionality which allows the user to insert text wherever his/her insertion point is located. For instance, if I had the following text in the RichTextBox:
"Hello World!"
And my insertion point was between the 'd' and the '!', how would I insert the string " today" at the insertion point's location so that the outcome would be:
"Hello World today!"
Thanks in advance.
Happy Programming and God Bless!
WWW::CodeProject::BNEACETP
|
|
|
|
|
That functionality is already there. Click at the point you want and start typing, so long as the RTB control's ReadOnly property isn't set to True. Even Copy/Paste works...
If you are trying to insert via code, then all you do is set the SelectionStart property to the position you want, set SelectionLength=0, then set SelectionText equal to whatever you want to insert at that point.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the help!
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I'm working on a business object that stores a DateTime as a property. In the context within which this object will be used, this DateTime property is most frequently referred-to property, so I would like to be able to write my code such that I can read and assign this date value directly, ie:
<br />
DateTime collectedDate = new DateTime(5, 28, 2004);<br />
string requiredString = "Additional info I need";<br />
bool[] requiredBoolArray = new bool[4]{true, true, false, true};<br />
myDateObject = new CustomDateObject(collectedDate, requiredString , requiredBoolArray);<br />
if (myDateObject <= System.DateTime.Now)<br />
{<br />
}<br />
else<br />
{<br />
myDateObject = System.DateTime.Now;<br />
}<br />
I've got the binary operators to evaluate my object as a DateTime value working just fine. My assignment operators are another story entirely - how do I create an assignment operator without having the other data in my object get reset to their default values (as happens below)?
<br />
public static implicit operator CustomDateObject(DateTime date)<br />
{<br />
CustomDateObject cdo = new CustomDateObject();<br />
cdo.Date = date;<br />
return cdo;<br />
}<br />
TIA...
-- Carter
Seattle, WA
"In illusion comfort lies" - SoM
|
|
|
|
|
Thats the first thing you should learn, never try and be fancy with operators and casts.
wickerman.26 wrote:
CustomDateObject cdo = new CustomDateObject();
cdo.Date = date;
return cdo;
I mean there is no logic! how on earth can the previous values magically appear if u are creating a new object?
top secret xacc-ide 0.0.1
|
|
|
|
|
I'd always thought that the first thing one should learn was to never use absolutes... At any rate, under the heading of sublimely unhelpful, we have:
leppie wrote:
I mean there is no logic! how on earth can the previous values magically appear if u are creating a new object?
Um, there was logic behind that question had you read it in it's entirety. The only way I could see how to cast a date struct into my date object was by returning a new instance of my date object; I was trying to find out if I was missing something. Evidently I wasn't.
See? No magic.
-- Carter
Seattle, WA
"In illusion comfort lies" - SoM
|
|
|
|
|
wickerman.26 wrote:
I've got the binary operators to evaluate my object as a DateTime value working just fine. My assignment operators are another story entirely - how do I create an assignment operator without having the other data in my object get reset to their default values (as happens below)?
You can't. It is like if you cast between an int and a byte. A byte can hold values 0 to 255, an int can hold values -2billion to +2billion (approx.)
byte myByte = 100;<br />
int myInt = (int)myByte;<br />
But if you do this:
int myInt = 1000;<br />
byte myByte = (byte)myInt;<br />
Actually the result is 232, which is the same as (myInt%256) . This is because to fit into an int the data had to be truncated, and if we try and reassign the byte back to the int, we will only ever see as much as was truncated.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Thanks, that's what I thought.
-- Carter
Seattle, WA
"In illusion comfort lies" - SoM
|
|
|
|
|
Can anyone point me to an example that seperates your Windows Form and it's events away from the class that actually carries out your Application logic?
|
|
|
|
|
CN78 wrote:
Can anyone point me to an example that seperates your Windows Form and it's events away from the class that actually carries out your Application logic?
Yes, create a new C# file, without any controls in it
top secret xacc-ide 0.0.1
|
|
|
|
|
Model-View-Controller Pattern[^]
This article describes the MVC pattern in relation to web pages, but many of the ideas also apply to Windows Forms.
From the above link:
The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:
Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
View. The view manages the display of information.
Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
I'm looking to read a text file that has properties coded on it ex : name=Joe
and can set a control with those properties at run time. Here is an example of what i've coded for this already :
private void ReadFile()
{
StreamReader sr;
string ;s
sr = File.OpenText("c:\\Test.txt");
s = sr.ReadLine();
sr.Close();
tabPage1.Text = s;
}
I need to start setting the numberOfTabs I want, the Alignment of the tabs.
|
|
|
|
|
Anonymous wrote:
private void ReadFile()
{
StreamReader sr;
string ;s
sr = File.OpenText("c:\\Test.txt");
s = sr.ReadLine();
sr.Close();
tabPage1.Text = s;
}
private Hashtable ReadFile(string filename)
{
string s;
Regex re = new Regex(@"^\s*(?<name>\w+)\s*=\s*(?<value>.+?)\s*$",
RegexOptions.ExplicitCapture);
Hashtable nv = new Hashtable();
StreamReader sr = File.OpenText(filename);
while ((s = sr.ReadLine()) != null)
{
Match m = re.Match(s);
if (m.Success)
{
nv.Add(m.Groups["name"].Value, m.Groups["value"].Value);
}
}
sr.Close();
return nv;
}
top secret xacc-ide 0.0.1
|
|
|
|
|
Sounds like what I use .ini files for.
I think there's a C# article on Code
Project that encapsulates WritePrivateProfileString
and ReadPrivateProfileString. Or you could
DLLImport them and roll your own.
Delphi has a pretty nice TIniFile class so
what I did was write a dual-interface COM
wrapper for it so I could use it with anything
that can use COM. I haven't tried it with
C# yet though. It worked fine with VB 6 and
VC++ 6.
|
|
|
|
|
Thanks for the replies, any other ways of doing this ?
|
|
|
|