|
DataReader gives you a forwatd only reading. So once you go to the end of it ,you can't return to first row again.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
You can't use a datareader as your datasource if your binding more than one control to it. You would have to bind them to a datatable in a dataset...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I draw a curve using the DrawCurve method. I also want to have some kind of interaction with the curve when moving the mouse over it. Could someone show me how to decide if a Point is on the curve?
Thanks!
|
|
|
|
|
Hello,
The way I have seen this done was in a project I worked on in a group for school.
Check out the Region and GraphicsPath classes. Region is found in System.Drawing and GraphicsPath is in System.Drawing.Drawing2D .
1. DrawCurve to screen
2. Create a GraphicsPath and draw to it.
3. Create a Region from the GraphicsPath .
4. Invoke IsVisible( somePoint ) on the Region .
In this case somePoint would be your mouse point.
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
|
There is a problem with this method. Though the curve is a open end curve, the region seems like a closed region. IsVisible returns true not only when the mouse is over the curve but also inside the region enveloped by the region. Have you encountered the same problem? How did you resolve it?
Thanks!
|
|
|
|
|
Hmmm.... I don't know how to fix that problem right off had. You will have to look through the documentation some more. I am sorry that this did not solve the problem exactly. Please post here again if you find a solution.
Sorry,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
I found the same problem as above and your description of the problem helped to give me the answer. If the path is closed already, the path.IsVisible(point) should work.
To keep the line as pure looking as possible using pixels, just reverse the points in the array and add them to the original set. Then add them to a closed curve in the path.
<br />
GraphicsPath _curvePath = new GraphicsPath();<br />
List<PointF> closedCurvePoints = new List<PointF>(_curvePoints);<br />
closedCurvePoints.Reverse();<br />
closedCurvePoints.AddRange(_curvePoints);<br />
_curvePath.AddClosedCurve(closedCurvePoints.ToArray());<br />
This worked well for me - even for curves that backed in on themselves. Hopefully it will be helpful to someone else if you have no need for this info anymore
|
|
|
|
|
Hi,
I am trying to create a program that connects to a remote host, and also acts as a server to listen for incoming connections (two in one).
However I want the program to begin listening for incoming connections immediately.
Two instances of a socket and IPEndPoint are created (In seperate classes, one for connecting and one for being a server), however they both use the same port number (As the program is a client/server).
Is this possible? Can I bind to the same endpoint as I am connected to / trying to connect to and send/receive data in both instances?
Thanks!
|
|
|
|
|
|
First off, sorry for the long question but I wnat to try and be clear. Any ways I have the following code:
static void Main()
{
Application.Run(new Form1());
}
Here is the constructor for Form1
public Form1()
{
// Form 1 Control definitions removed
newClass1= new NewClass();
newClass2= new NewClass();
Thread Thread1=new Thread(new ThreadStart(newClass1.Start));
Thread Thread2=new Thread(new ThreadStart(newClass2.Start));
Thread1.Start();
Thread2.Start();
}
Here is the New Class Constructor:
Public NewClass()
{
Context=new ApplicationContext();
Form2 ChildForm1=new Form2();
Form2 ChildForm2=new Form2();
Context.MainWindow=ChildForm2;
}
Here is the thread Start delegate:
public void Start
{
Application.Run(Context);
}
If a method on Form 1 wants to call a method on the instance ChildForm1 an Invoke call must be used and it works. However if a call on Form1 wants to call a method on ChildForm2 the InvokeRequired property always shows false and an Invoke call won't work. Why??
Thanks for an help
Jeff
|
|
|
|
|
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
|
|
|
|