|
I'm using an object created from a class that I've called Interval. The class consists of two private members (min and max) of type double and get/set (Min, Max) for each private member. When Min is set it is compared with Max to ensure that Min is less than or equal to Max. This comparison is working at run time but not at design time. At design time the value of Max is the same as I set as default value in the class (private double max = 0) and not the value that is set in the property window in the designer.
I hope someone could help me with this problem.
Thanks in advance
/Anders
-- modified at 6:59 Monday 30th April, 2007
|
|
|
|
|
Hi,
I want to store a set of codes in an XML file and read the contents. I want each object to be a item consisting of a name and a code, so that I can put the name in and get the corresponding code out. What's a simple and efficient way of doing this?
I can't use my web.config as there may be many codes.
Thanks
|
|
|
|
|
Assuming your object value can be rendered as a string, XmlTextWriter and XPath are your simplest tools. A simple WriteElementString to write each object with the element name for your object name, and the element value your object value. Then for reading you load the file into an XmlDocument, and use an XPath query for the element with your object name, and get its value.
public static void Write()
{
using (XmlTextWriter tw = new XmlTextWriter(myFileName, System.Text.Encoding.Default))
{
tw.WriteStartDocument();
tw.WriteElementString("ObjectName", "ObjectValue");
tw.WriteEndDocument();
}
}
public static void Read()
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(myFileName);
XmlNode myObject = xdoc.SelectSingleNode("ObjectName");
string myValue = "";
if (myObject != null)
myValue = myObject.InnerText;
}
|
|
|
|
|
That's great, thanks
|
|
|
|
|
I have written a component called PlotPanel which inherits from System.Windows.Forms.Panel. When the control is used in the design window the default constructor "this.plotPanelReal = new PlotPanel();" is generated in "Windows Form Designer generated code". I want to use an overloaded constructor instead: "this.plotPanelReal = new SEA.PlotPanel(nbXMin, nbXMax, nbYMin, nbYMax);" (nbXXXX is number boxes which inherits from TextBox).
If I just change the row "this.plotPanelReal = new PlotPanel();" in "Windows Form Designer generated code" to "this.plotPanelReal = new SEA.PlotPanel(nbXMin, nbXMax, nbYMin, nbYMax);" it works until I do some changes in the designer then row is changed to the default constructor again.
If I just leave the row "this.plotPanelReal = new PlotPanel();" in "Windows Form Designer generated code" and instead place "this.plotPanelReal = new SEA.PlotPanel(nbXMin, nbXMax, nbYMin, nbYMax);" in, for example, the constructor of the main class the arguments is not making any difference. The reference of the number boxes is not passed to the PlotPanel object.
Please, help needed
/Anders
|
|
|
|
|
Don't change the Windows Forms Designer generated code. There is a big warning message telling you not to.
If you instantiate the object in the constructor of the form the code in the InitialiseComponent method will replace your version with its own. This is evident if you step through the code with the debugger.
Two options:
* If you want to keep using the designer for this control then you should be passing this information as properties to the control rather than in the constructor.
* If you don't mind the loss of the designer control over this control then do it all manually in the constructor (or your own method called from the constructor)
|
|
|
|
|
I have made a Rss Reader (Windows app) - it takes one Url(i.e. watever.com/rss.xml) and reads its contents. But its not working with those sites which have authentication (e.g. those sites need userid/password to enter and read Rss feed).
My question is how can I authenticate to a site thru my application or thru programming ?
I need some help.
----------------------------
**** JOB23743 Submitted ****
|
|
|
|
|
Depends on the kind of authentication the site requires, if the site uses cookies to set authentication, then use cookies in your code.
|
|
|
|
|
It requires http authentication.
----------------------------
**** JOB23743 Submitted ****
|
|
|
|
|
|
Hi all,
This is the scenario: the user is able to initiate some process by selecting some data from a form, dragging it and dropping it onto another independent form. I want to add the option of introducing a context menu if the user were to use the right mouse button to do the drag&drop just before said process is initiated (using the context menu, the user can define how that process behaves).
My initial attempt looks something like this:
<br />
...<br />
private void HandleDragDrop()<br />
{<br />
doSomething<br />
...<br />
contextMenuStrip.Show();<br />
...<br />
doSomethingElse<br />
}<br />
Two problems with this:
1. contextMenuStrip.Show(); by itself doesn't appear to be blocking. It does display the context menu but then goes ahead and executes all subsequent commands without waiting for user input.
2. The selection made is handled elsewhere using a standard Click event handler so even if I were able to stop the program to await user selection, I wonder if the context would leap from the Click event handler back to the statement immediately following the .Show() command. Sounds too easy for it to be correct...
Ideally, I would like to be able to do something similar to
<br />
...<br />
DialogResult response = MessageBox.Show(...);<br />
if (response == DialogResult.OK)<br />
...<br />
...but using a context menu (because I want to be able to select from a list of options and not just Yes or No but mainly so that users do not get upset if they were to see a Message Box rather than a context menu...).
Any ideas or help would be greatly appreciated!
cheers!
|
|
|
|
|
jozsurf wrote: 1. contextMenuStrip.Show(); by itself doesn't appear to be blocking. It does display the context menu but then goes ahead and executes all subsequent commands without waiting for user input.
that's because contextMenuStrip.Show(); doesn't work like ShowDialog.. it only presents you the menu..
if "...doSomethingElse" depends on what user does/selects in the menu you should put it in context menu items event handlers.. onClick for MenuItems for example..
life is study!!!
|
|
|
|
|
cheers! that makes sense. The code will need a little refactoring though...
|
|
|
|
|
Hi, i'm creating a C# program that measures date differences. for example i have 2 text boxes, one text box contains the date 4/12/2007, the other text box contains 5/23/2008. I need to count the number of days difference from 4/12/2007 to 5/23/2008.
Im sorta new to C# and i have no idea how to do this, since i cant just treat it as simple numerical values, given that it must reference the calendar for the measurements to be exact.
thanks in adavance..
|
|
|
|
|
See the documentation for the DateTime and TimeSpan classes
|
|
|
|
|
Colin Angus Mackay wrote: See the documentation for the DateTime and TimeSpan classes
tnx!
|
|
|
|
|
Please Can you explain me how to use existing .resx file for a new project. I attached the existing resource file correctly. When i do it i ll get a error saying
"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Mockup.Mockup.resources" was correctly embedded or linked into assembly "OfficePlanSample" at compile time, or that all the satellite assemblies required are loadable and fully signed. "
Here "Mockup" is the new namespace name and the internal class name and "OfficePlanSample" is the new namespace name. please can anybody help me in here. Thanks.
Asith
|
|
|
|
|
just copy in ur project and do something like myresource.mykey, right click on the resource file and check it's properties change to "embeded"
|
|
|
|
|
Thanks for your reply mate, now its working properly.
Asit
|
|
|
|
|
Dear All,
Is there any method avl to export the images in a PDF document via Dotnet.
Thanks In Advance
Dana
|
|
|
|
|
No, there is no PDF support whatsoever, without third party libraries.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Dear Christian,
Thanks for your reply.Is there any free thrid party avaliable.I found one DLL .That is iTextsharp.But it doesnt have the image export method
Dana
|
|
|
|
|
There are free ones, but they generally just create a PDF from text or maybe images. I don't know, if I needed one, I would buy one. b/c if I was making money, I'd spend money to make sure it worked OK.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Can you mention some dll(paid one) which will extract the images from pdf pages
|
|
|
|
|
how to do this? i have this code written:
Dialog1::Dialog1(CWnd* pParent /*=NULL*/)
: CDialog(Dialog1::IDD, pParent)
{
dlg.Create( IDD_DIALOG2, pParent);
}
void Dialog1::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
CRect rectClient;
CRect rectWnd;
GetWindowRect( rectWnd );
GetClientRect( rectClient );
rectClient.OffsetRect( rectWnd.left, rectWnd.top);
dlg.SetWindowPos(&wndTop, rectClient.left, rectClient.top, rectClient.Width(), rectClient.Height(), SWP_SHOWWINDOW);
dlg.ShowWindow(SW_SHOW);
}
but dialog2 shows behind dialog1 and doesn't move follow dialog1
i want make dialog2 as a part in dialog1
Thanks!
|
|
|
|