|
|
Hard to tell without seeing the code. If you are not creating new form object each time, it should retain all the controls and it's values.
Please post the relevant code.
|
|
|
|
|
It shouldn't reload the controls each time unless you are constructing an instance of it each time (i.e. AForm Form2 = new AForm()) or you are calling some other method which forces it to reinitialise (e.g. are you handling some event in Form2 which initialises the controls)
Easy to see - breakpoint at ShowDialog and trace in to see what happens. If you're not sure if it's the same instance of the form each time, set the title to be the current time in the constructor.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I will set a break point and do a trace. I only create Form2 once. Form 2 only gets initialized once as well. However I can tell you that every time Form2.ShowDialog(this) is called it gets into my Form2_Load but when I call it using Form2.Show(this) it only gets into Form2_Load once.
Below is a sample of code that is creating and Showing Form2.
<pre>
public partial class Order : UserControl
{
public OrderEntry.UserControls.OrderOptions orderOptions = new OrderEntry.UserControls.OrderOptions();
public Order()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void setupButton_Click(object sender, EventArgs e)
{
if (this.orderOptions.ShowDialog(this) == DialogResult.OK)
{
}
else
{
}
}
}
</pre>
Below is a sample of Form2.
<pre>
public partial class OrderOptions : Form
{
public OrderOptions()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Need to makes sure that all controls are enabled and disabled correctly.
if (this.printImmediately.checkBox1.Checked)
{
this.invoiceMsg.Enabled = true;
this.receiptMessage.Enabled = true;
}
else
{
this.invoiceMsg.Enabled = false;
this.receiptMessage.Enabled = false;
}
if (this.barcodeScanning.checkBox1.Checked)
{
this.stopInQuantity.Enabled = true;
}
else { this.stopInQuantity.Enabled = false; }
}
private void OrderSetup_FormClosing(object sender, FormClosingEventArgs e)
{
this.Hide();
e.Cancel = true;
}
}
</pre>
|
|
|
|
|
|
Well, I would think this is how it is meant to behave.
When you Show() a form, you may show and hide it, with the 'controlling' program deciding upon its visibility, but it is only Loaded the first time it is shown.
With a dialog form, you have to close it before continuing - so as it is closed, showing it again 'Loads' it.
I'm guessing you are hiding the dialog to save time in having to recreate it each time?
If you want to keep the values, set them up in the Form2 constructor - then they won't be set again - or add your own 'init' method which you can call when you want to initialise the form.
The bottom line is that the Load event is triggered when the ShowDialog method is used, so don't put code there when you don't want it executed every time.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Setting up the values in Form2's constructor fixed my problem. Thank you very much.
|
|
|
|
|
Not a problem - glad to be of help
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Hi,
I need to parse some text that's currently is in PDF-format so I'm thinking that converting it to text or html would be a good place to start.
There are a lot of PDF-component out there for C#, has anyone of you tried anyone and can tell me which once are doing a good job.
Thanks.
|
|
|
|
|
I have used PDFBox. But its in java. So you need to use iKvm.net to use PDFBox.dll in .Net. It has a class called PDFTextStripper which has a method called getText. But this will only work on Text PDF. It won't work on Image PDF.
But if it not that much taks you can use iTextsharp.
One more thing So far I have learned that iTextsharp is great for creating pdf and PDFBox is great for parsing/reading pdf.
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
I tried iTextsharp but it really did a terrible job with my PDF so now I'm playing around with PDFBox and it seems to be doing a much better job.
|
|
|
|
|
The following is the exact message I am getting when running the application from Visual Studio 2005, trying to load a .dtsx package. I could not add a screen shot here. The code is so simple that I cannot understand what the path problem is.
Failed to open package file "\Serv37\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx" due to error 0x80070003 "The system cannot find the path specified.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.
The. ,dtsx package and code are both located on the server. I can run the .dtsx package fine in BIDS and get the required result. When the code runs to the line "pkg = app.LoadPackage(pkgLocation, eventListener);" that is when I get the "Failed to open package file" error.
Below is a re-posting of the actual code:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace DocBeaEntry
{
class MyEventListener : DefaultEvents
{
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError)
{
// Add application-specific diagnostics here.
Console.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description);return false;
}
}
public class clsSSIS
{
public static void RunDTSX()
{
string pkgLocation;
Package pkg;
Application app;
DTSExecResult pkgResults;
MyEventListener eventListener = new MyEventListener();
pkgLocation = @"\Serv37\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
app = new Application();
pkg = app.LoadPackage(pkgLocation, eventListener);
pkgResults = pkg.Execute(null, null, eventListener, null, null);Console.WriteLine(pkgResults.ToString());
}
}
}
|
|
|
|
|
Try changing:
pkgLocation = @"\Serv37\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
to
pkgLocation = @".\Serv37\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
|
|
|
|
|
unfortunately, I came up with the same error. I just cannot understand what I am doing incorrectly. It has to be caused by something on the server somehow. I actually have the asme code in Vb and it works just fine but the c# code does not want to work past this line.
pkg = app.LoadPackage(pkgLocation, eventListener);
I have tried the following for the pkglocation,
they all give me the same error:
Failed to open package file
pkgLocation = @".\Serv37\M:\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
pkgLocation = @"\\Serv37\M:\wwwroot\AS-
MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
pkgLocation = @"\Serv37\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
pkgLocation = @"\\Serv37\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
pkgLocation = "\\Serv37\\wwwroot\\AS-MIS\\LoadBeaPayroll\\LoadBeaPayroll\\package.dtsx";
Any more suggestions anyone?
|
|
|
|
|
Sorry, I didn't realize that Serv37 was the server name...
|
|
|
|
|
mecca1 wrote: pkgLocation = @"\Serv37\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
try using (i.e)
pkgLocation = @"c:\wwwroot\AS-MIS\LoadBeaPayroll\LoadBeaPayroll\package.dtsx";
in local machine
if file location in other machine, make sure you have shared that path and have an access right.
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
Hi guys. ...having a little bit of trouble here. Hopefully, it's just that I'm not viewing the correct file: but here's the problem:
(.NET Framework 3.5 / VS 2008)
I have to create an "Unauthorized Access" page within one of our systems. Site navigation is handled via a NavControl on the Master Page and all pages are linked into the Master Page. To keep layouts consistent, I need to also incorporate that Master Page into the new Unauth page, which means that the other components of the Master Page are supposed to remain visible, but the Navigation needs to be hidden from an unauthorized user, save for a nav button to "Login"
However, I am having trouble accessing the NavControl programmatically within the Page_Load of the Unauth page. To access the control, I need to provide the proper ordinal to the collection
base.Master.Controls[]
but, whenever I view the designer.cs, I cannot see the Control registration order, which would mean that the ordinal that I provide would simply be a stab in the
dark.
Does Anyone know how to get this?
Does Anyone know of another way to access the control?
Note: I was able to pull the control by introspecting the Controls collection in a Debug Watch, but accessing a control via ordinal seems very pedestrian - I'm looking for something that's a little more explicitly defined than trusting that ordinal 3 will always be my NavControl. Any help?
"I need build Skynet. Plz send code"
modified on Thursday, February 5, 2009 1:38 PM
|
|
|
|
|
hi,
i need to change the visuals of the TrackBar, how do i do something like this???
do you have a snipped for me?
|
|
|
|
|
|
Hello!
For my diploma project, I must create an application that communicates with another device ( a data logger) via a Firewire connection. I chose to create this app in C# (Visual Studio 2005) , as it is the only visual development language I learned during the faculty years.
My question are:
1) How does one achieve communication through this interface? Can it be used like a normal network connection ? I noticed that in the Network Connection panel it seems to be viewed by Windows like a normal connection....
2) The data logger doesn't understand the TCP/IP protocol ( only Network Layer 2 ...). The app should basically receive huge amount of data from the logger, and it should also send some command packets. What I need to do is analyze every packet that comes from the logger , and store it, but it is difficult because of TCP/IP being not supported. Can i use the WinPCap / SharpPCap dll's for raw packet manipulation ? If not, can someone please tell me how do I access the raw packets that are received / sent by the FireWire? Is there such a dll?
Thank you in advance!
George
P.S. Sorry for my English... i learned it from cartoons
|
|
|
|
|
I have created a setup file in windows application and then i installed it in my system only. After giving userid, password for authentication from the database,even if the userid and password is contained in the database, i am getting the exception "System.Data.SqlClient.Sqlclientpermission,system,.........,publickey token='......' failed"
|
|
|
|
|
you mean your putting username/password in connection string? if so you need to set up database on server with useraccount that matches those value, does not matter if they stored in any table
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
I think there's something wrong in the security settings. Are you sure that SQL Client is placed in GAC? Also do you start your program from trusted folder? SQL Server Client needs pretty much privileges.
|
|
|
|
|
My project is a windows application. After i install the setup file of this project. I am getting the first form, i need to select from four options i,e. four buttons. When i press a button, next form is displayed asking for username and password. After giving username and password, when i press login button then i am getting that exception. If i run normally in visual studio 2005 , it is executing .
|
|
|
|
|
Good day helpers
I'm not sure how to embedded my code to a PDA.
|
|
|
|