|
You really need to work on accurately describing what you looking for.
From the Crystal remark I assume you are wanting to generate some sort of report, the "generate multiple pages" comment though leaves several questions. What do you mean by pages? ASP.NET pages, report pages? Stop trying to be so vague.
only two letters away from being an asset
|
|
|
|
|
An html page with all the inform on multipages, nothing complex?
Ferron
|
|
|
|
|
Format the data as XML and use an XSLT to produce HTML pages.
only two letters away from being an asset
|
|
|
|
|
Collection of controls
I would like to :
1. Add a set of controls within a collection e.g. an arraylist.
The controls consist of textboxes, dropdown lists, and calendar controls.
2. Loop through each control (i.e. using foreach) and set the enabled property to true, so that the user can update some text.
I'm aware that there are a lot of articles on this, however, I could not find a way to retrieve the common property 'Enabled'. Any ideas?
One button is going to appear to the user intially showing 'Create task' then changing appearance to 'Update new task'. Shouldn't be a problem, but is there something more efficient than the 'text' to validate e.g. if 'button.text == "Create new task", sounds like a lot of work for the processor.
- Controls are going to be bound to a SQL database.
- Currently using ASP.NET 2.0 / C# / VS 2005 Team Edition
Any ideas?
Jon
|
|
|
|
|
jon_80 wrote: I could not find a way to retrieve the common property 'Enabled'
Enabled is a property of the base class Control. What do you mean can't find it? What are you trying?
only two letters away from being an asset
|
|
|
|
|
Hi,
all Controls have an Enabled property, hence this should do it:
List< Control> controls=new List< Control>();
...
controls.Add(new TextBox());
...
Button btnCreate=new Button();
btnCreate.Text="Create";
controls.Add(btnCreate);
...
controls.AddRange(anotherControlsList);
...
foreach(Control c in controls) c.Enabled=true;
...
btnCreate.Text="Update";
This is all very basic, you should consider buying and studying a tutorial on C# and
Windows programming.
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:11 PM
|
|
|
|
|
Thanks, I have books, but sometimes I just don't find what I'm looking for
Jon
|
|
|
|
|
It is not sufficient to have books, what helps is:
- study a tutorial book from page 1 to as far as you get;
- study it again a couple of months later;
- repeat until you get to the end;
- have and consult a reference book.
Consulting the reference book could be replaced by searching the internet;
nothing however replaces studying a tutorial.
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:11 PM
|
|
|
|
|
For the button text, you could use a Boolean field, let's say it could be named createNewTask and is initialized to true . Then, in the button's click handler you can toggle the Boolean field. Also if you make a Property for the Boolean field, then you can put the setting of the button's Text property in the Set of the Boolean Property ; make sense? Like this:
public partial class ... : Form (Page? for ASP.NET)
{
....
private bool createNewTask = true;
private bool CreateNewTask
{
get { return createNewTask; }
set
{
if(createNewTask != value)
{
createNewTask = value;
if(createNewTask)
btnCreateNewTask.Text = "Create";
else
btnCreateNewTask.Text = "Update";
btnCreateNewTask.Text += " new task";
}
}
}
....
}
I don't use textual comparison of a control's Text property to control the state of a control, just personal preference. Plus, I think making a Property and linking the Property's Set method with the visual changing of the control's state is really intuitive and makes it easy to maintain if you have to expand on it later. If you find yourself having more than 2 possible values (maybe the button needs to function in 3 different ways instead of 2), then use an Enum to define the different ways it can work and put a Property around a private Enum field with a switch in the Set of the Property ; similar to how I did it with a Boolean above.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
So your solution is to add more properties and thus more memory overhead and storage? Not to mention the added complexity of maintaining a variable number of properties for a variable number of controls.
only two letters away from being an asset
|
|
|
|
|
OK, not sure how you came to that conclusion. I said to use a single Boolean Property (with a Get and Set) to a single boolean variable to control the button's state, rather than relying on a textual comparison of the button's Text Property. I also said if you have the need to go beyond two states and a boolean will no longer suffice, to use the same approach but with an Enum. Which would still be a single Property with a Get and Set to a single variable of the Enum type. I think that using a Property in this manner lends itself well to what actions need to occur and the events that trigger them.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Hello,
i have associated my program with a own file extension and icon. When i double click on a file with this file extension the program starts.
Is there a way to find out in my program, on which file the user has double-clicked, so i can get the whole path of this file (c://test/test.extension for example)?
I need that, to load the data (from a database), when the user has clicked on the file and the program starts. Actually the user have first to open the openfiledialog (after the program has started) to choose the file.
So i could make my program more comfortably
Thanks for your help!
Thomas
|
|
|
|
|
Hi,
when one or more files get double-clicked their associated EXE gets launched, and the filename(s) are passed as command line arguments. Have a look at the Environment class.
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:11 PM
|
|
|
|
|
Hello,
thank you very much for your help.
I have get the path with the method ( --> Environment.GetCommandLineArgs() )
I get the path in a short form (C:\Documents ~ ...). Do you know, how i can change this path in the "full" form like C:\Documents and Savings\file.mdb ?
Another Question you mabye know: i have my programm associate with a own file-extension. If i click on a file with this extension with the right-mouse button, and go on "open with", it shows only the icon of my program, but not the program-name like "Microsoft Office Access". Do i have to define a value for this in the registry. How i can do that?
Thank you very much, again!
Thomas
|
|
|
|
|
Hi,
there are several ways to associate a file extension to an app; here are some:
1. add code to that effect in your app; I typically don't do that
2. modify the registry directly; I try not to need that
3. double-click a file with the new extension and answer the questions asked, checking
the "remember..." checkbox or whatever it gets called (depends on OS). That is what I do.
4. I guess you can also have an installer and have it take care of file associations; I never did that.
The net result is it gets stored somewhere in the registry. Normally the value of the entry should read myAppName "%1" which makes it surround (each of) the filename(s) with double quotes, keeping paths with embedded spaces together. Seems like you got it wrong somehow, so I am afraid you have to use the registry, search for your app's name, and either fix it there, or remove it, and redo the association.
PS: as always, be very careful when opening and modifying the registry; it is the ideal way to really screw up an entire system...
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:12 PM
|
|
|
|
|
The file that caused your application to fire is passed in to the Main method as an argument. Just look into the string[] args list to find out what the file was.
|
|
|
|
|
Pete O'Hanlon wrote: ... the Main method as an argument
And how would I pass that information to a form in my Program.cs file???
It only has a constructor without parameters
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:12 PM
|
|
|
|
|
Luc Pattyn wrote: It only has a constructor without parameters
Which you aren't constrained to using - we never used to use the default form constructor (partially because we use the main to do login functions, and passed tokens into our forms).
|
|
|
|
|
|
hi ,
In "DB1" database I have tables called "Warehouse" and "Machines"
Both are related, 1 Warehouse can have many machines. 1 to many relation ship.
But there is another table "Warehouse" in another database = "DB2"
The one in DB2 is the original Warehouse table which has all the data. Since warehouse and machines are related, I thought of having a warehouse table in DB1 and later can run a SQL job to update the table in DB1 from the one in DB2 . But my requirement is such that I should not have the Warehouse table in DB1, but use the same one in DB2.
But I know that I cant relate tables from 2 databases.
How can I achieve the above requirement
Happy Programming!
Regards,
ctrlnick !
|
|
|
|
|
|
Both the databases are under the same server
Happy Programming!
Regards,
ctrlnick !
|
|
|
|
|
Was this a statement or do you have another question?
only two letters away from being an asset
|
|
|
|
|
Hi ,
I thought linked server was used for 2 different server.
So I wanted to know how to implement that on tables on same servers
Thanks
Happy Programming!
Regards,
ctrlnick !
|
|
|
|
|
Your DB2 database is external to SQL Server, it doesn't matter that it is physically on the same server.
only two letters away from being an asset
|
|
|
|