|
A better solution that your users would appreciate more is to actually speed up the loading of your application rather then pointing out how slow it is to start up . This is typically accomplished by:
1) lazy load / load on demand
2) background loading
3) determine what is causing the long delays and fixing it
Typically one major issue is trying to load an entire datebase into memory. Yeah, easier to code, but you don't really need an entire database at start up. Switch to stored procs and retrieve only the data you need.
|
|
|
|
|
I typically load only the master tables (those required by comboboxes throughout the app) as these are invariable quite small. I also load these asynchronously.
Rather than trying to use a progress bar (so 90s) I use a busy indicator.
Then each View/form/page loads only the content required. As Sledge pointed out this is called lazy loading (I suspect he also load the mater table as required)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I studied many questions in this forum that related to this problem.but I couldn't solve my problem.can you help me?the error happens in the line which was indicated by "****"
private static DataGridView Firstdgv;
private static DataGridView Finaldgv = new DataGridView();
private static List<string> SelectedColumns = new List<string>();
private static List<string> AvailableColumns = new List<string>();
public void Print_DataGridView(DataGridView dgv1)
{
PrintPreviewDialog ppvw;
try
{
Firstdgv = dgv1;
AvailableColumns.Clear();
foreach (DataGridViewColumn c in Firstdgv.Columns)
{
if (!c.Visible) continue;
AvailableColumns.Add(c.HeaderText);
}
FrmPrintOptions dlg = new FrmPrintOptions(AvailableColumns);
if (dlg.ShowDialog() != DialogResult.OK) return;
PrintTitle = dlg.PrintTitle;
PrintAllRows = dlg.PrintAllRows;
FitToPageWidth = dlg.FitToPageWidth;
SelectedColumns = dlg.GetSelectedColumns();
ppvw = new PrintPreviewDialog();
Finaldgv.AutoGenerateColumns = false;
foreach (DataGridViewColumn GridCol in Firstdgv.Columns)
{
if (!GridCol.Visible) continue;
if (!SelectedColumns.Contains(GridCol.HeaderText)) continue;
Finaldgv.Columns.Add(GridCol); ****
}
DGVPrinter obj = new DGVPrinter();
obj.PrintPreviewDataGridView(Finaldgv);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
|
|
|
|
|
Try:
Finaldgv.Columns.Add((DataGridViewColumn)GridCol.Clone());
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thank you
It works
|
|
|
|
|
Dear friend now I have another problem.I want to know that how can I access to a column contents?
because "Gridcol" just returns columns header and in "Finaldgv" just columns header will be added. Actually I need each columns header text with its contents .
thank you.
|
|
|
|
|
I created a window with a field to set the name that the file will be saved. And with the code below I run inside the MainWindow.
var dialog = new windowFileName();
if (dialog.ShowDialog() == true)
{
MessageBox.Show(dialog.strFileName_str);
}
But I'm not getting check if the field is empty. I tried:
if (dialog.ShowDialog() == false)
{
MessageBox.Show("Please, enter the name file");
dialog.txtFileName.Focus();
}
But the dialog close and does not work.
|
|
|
|
|
juliogyn wrote: But the dialog close and does not work. Of course it does, because the tests you are making only happen after the ShowDialog() method returns. Check http://msdn.microsoft.com/en-us/library/c7ykbedk.aspx[^] for full details of how this operates. You need to trap the events that cause the dialog to be closed, and add your tests there to prevent it closing until the correct data is entered by the user.
Veni, vidi, abiit domum
|
|
|
|
|
Get the first day of the month and the last day of the month ?
Below is the error code
kptDTPickerTo.Format = DateTimePickerFormat.Short;
kptDTPickerTo.Value = "01/" + DateTime.Today.Month + "/" + DateTime.Today.Year;
kptDTPickerFrom.Value = DateTimePickerFormat.Short;
kptDTPickerFrom.Value = "01/" + DateTime.Today.AddMonths(1) + "/" + DateTime.Today.Year;
kptDTPickerFrom.Value = kptDTPickerFrom.Value - 1;
modified 10-Sep-13 5:09am.
|
|
|
|
|
Where is the error code and what is your question?
Veni, vidi, abiit domum
|
|
|
|
|
I think the "error code" actually means the "code that is wrong", and I'm pretty sure his question is "I haven't bothered to step through the code, so I don't know why it's wrong".
|
|
|
|
|
Well, there are a few problems I can potentially see here. The first being what happens if the date format isn't set so that the month forms the second part of this? Your logic will go out the window. Plus, surely you just need to simplify the end date bit by subtracting one from the first day of this month + 1 month. In other words, the logic in your to picker is wrong in that you are adding 1 month to today and then expecing the last day to somehow be found out just by subtracting 1.
|
|
|
|
|
In case you're still wondering how to find the last day in the month, all you need to do is use DateTime.DaysInMonth . This is a handy method that returns this information.
|
|
|
|
|
Nothing is wrong with this code, fellas. This approach is format, Culture independent.
I've used this kind of logic many many times and its very compact.
As is obvious to all, 1st of a month is never a problem because all months have 1st.
Instead of writing yet another variant in C++/C# for "30 days hath sep...", simply add 1 to month to the variable you had for 1st of month, and then subtract 1 day from the Resulting date.
It is meant to done in date arithmetic with valid values in Date's class.
|
|
|
|
|
|
Why the default color green is not changed for progress bar control even though if change the forecolor property value to something else.it is always green by default.
|
|
|
|
|
You cannot set the color unless you remove the line Application.EnableVisualStyles(); from the main file.
This line enables the default windows color on your application.
Note that removing this line will have an impact on the entire form.
|
|
|
|
|
superselector wrote: Why From the documentation[^];ForeColor and BackColor changes for the ProgressBar will not be honored when visual styles are enabled on Windows XP Home Edition, Windows XP Professional, Windows Server 2003 and above.
You'd could paint your own progressbar, or try one the articles here on CodeProject.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I got an error when calling a secure(query string url) connection from c# code .any one got the same issue please help me.
issue : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
code :
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse webresponse = (HttpWebResponse)request.GetResponse();
request.Accept = "text/plain";
StreamReader responseStreamReader = new StreamReader(webresponse.GetResponseStream());
string response = responseStreamReader.ReadToEnd();
Thanks,
Shinu K
|
|
|
|
|
Make sure you are connecting to the url as https and not http.
|
|
|
|
|
C# vs Delphi. any ideas?
I am looking for few ideas & comments using the above technologies in,
- web based application,
- Large(which is good for future development)
- Faster(I guess Delphi)
- The development environment
|
|
|
|
|
There are even more facets to this.
For e.g.
It depends not only on your skill set but of the team you are planning to deploy.
I guess finding C# resources are better than Delhpi.
I would assume C# has a better development environment.
|
|
|
|
|
Swinkaran wrote: C# vs Delphi. any ideas? That's like meat vs. cheese on a sandwich.
Swinkaran wrote: - web based application ASP.NET would be the most widely used; meaning it's easy to get devs that are familiar with it and that there's quite some documentation.
Swinkaran wrote: - Large(which is good for future development) What is "large" in your opinion? Does it generate a huge executable? Consist of multiple projects?
Swinkaran wrote: - Faster(I guess Delphi) In converting ints and adding them to a list, yes; Delphi would be faster. C# has a better overall performance, due to things like thread-pooling.
Swinkaran wrote: - The development environment I enjoy the VS2012 IDE; haven't seen the Delphi IDE since v6.
FWIW; it's allowed to mix both languages - I'd recommend using .NET, and to plug in your Delphi-code when you find that you "need more speed" or want to juggle with pointers.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi All !
The Event of btnNext_Click in DataGridView here is my Code :
int numOfRows = dgv.Rows.Count - 1;
int index = dgv.CurrentRow.Index;
if (index < numOfRows)
dgv.CurrentCell = dgv[0, index + 1];
else
dgv.CurrentCell = dgv[0, index];
the problem is I want to use :
dgv.CurrentRow=...
to Select Current Row .the property of CurrentCell active One Cell of Current Row.
Thanks
|
|
|
|
|
I'm not sure you'll get much help on this until you write in complete sentences and explain what the problem is more clearly.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|