|
Use the ComboBox SelectedItem property instead of SelectedValue.
Double a = Convert.ToDouble(cmbqua1.SelectedItem);
Double b = Convert.ToDouble(txtrt1.Text);
Double result1 = a * b;
txtpr1.Text = result1.ToString();
Jibesh V P
|
|
|
|
|
thank you.. it works
|
|
|
|
|
Glad it works. but do try to spend some time debugging your application and do some google search... its always good to solve an issue by self and issues these are easy to be find by self.
Jibesh V P
|
|
|
|
|
Parse the Text values (they are strings in there, not actual numbers you can use) into an appropriate datatype, such as an Integer adn do your math with those values. See TryParseInt32.TryParse()[^] for more information and an example.
|
|
|
|
|
You will likely find that NumericUpDown s are more appropriate to the task.
|
|
|
|
|
Hi
I have 3 different projects (all in Windows Forms). I want to make a fourth form which will be the Menu form from which I can navigate to the other forms. I'm looking for a way to combine all these project to the fourth project so I'll be able to access the other forms from the Menu form. I tried the "add existing item" but the problem is that all the forms in all the projects are named Form1.cs and Form1.Designer.cs so it doesn't let me (although the forms have different names).
So how can I combine all these project? or how can I change the name of a cs file without doing any damage?
Thanks a lot.
|
|
|
|
|
You'll probably have to rename these files and change the class names to something more meaningful, then copy the files into the same project.
No, there is no easy and/or automated way to do this.
|
|
|
|
|
how to cache data with dictionary in C#?
|
|
|
|
|
You put the lime in the coconut and you drink it all up.
A better question may get a better answer. (Though I wouldn't put any money on it.)
modified 9-Feb-13 11:54am.
|
|
|
|
|
PIEBALDconsult wrote: You put the lime in the coconut and you drink it all up.
And now I feel better
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You're question is about as broad as it could possibly get, so the answer is going tobe just as broad:
You save the data in the Dictionary with a Key value so you can look it up.
Without knowing more about what it is you're trying to cache, how much data is in each entry and how much data you want to cache overall and for how long, what kind of application you're talking about (WinForms, WPF, ASP.NET, ...) it's pretty much impossible to tell you anynthing useful.
Remember, the quality of the answer you get is directly dictated by the quality of the question you ask.
|
|
|
|
|
thankue for yoyr attention.
my applitaion is a web application and a i want to cache a main menue items .for that have a 30 items .
when user click on a main menue i want to load items from cash .
my menue is daynamic and user can have own menues items
|
|
|
|
|
Well, .NET 4 and above has caching supporting built in. This was taken from the old Caching Application Block in the Enterprise Library after version 5.0. You can read more about that here[^].
There's also ASP.NET's builtin support, here[^].
|
|
|
|
|
For basic caching, you can build your own simple mechanism.
For e.g. cache in a temporary table in the database.
For complex solutions, there are a number of third party tools available that support caching.
|
|
|
|
|
in my windows application
i have a Button=EditShapeFile
when am clicking editshapefile this will auto matically generate three columns in shape file.
How it is Possible Using C#
|
|
|
|
|
allasanthosh wrote: when am clicking editshapefile this will auto matically generate three columns in shape file.
What do you mean by columns, and what is the format of the file contents?
|
|
|
|
|
Excel Sheet columns in string format
|
|
|
|
|
I already provided you some links showing how to work with Excel files using OleDB.
|
|
|
|
|
Please don't bump[^] your question.
I'm skipping this one.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
can anyone explain me about lambda expresion benefit?
|
|
|
|
|
It's shorter.
Less code = easier to read = less maintenance = fewer bugs.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Adding to the first answer.
It allows to use closures which means you can use local state inside the lambda easily. This is very powerful and simplifies the code.
Best wishes,
Navaneeth
|
|
|
|
|
|
Hi,
I am working on a application that creates a report with pretty complicated graphics, which no doubt takes a lot of time. In order to convince the users that the program is actually working and has not hanged itself up, I thought of using a small window that shows a spinning gif image along with some message asking them to wait for the process to complete.
This is how I have implemented the functionality
class MainForm
{
Thread LenghtyOperationThread;
private void buttonCreateReport_Click(object sender, EventArgs e)
{
LengthyOperationThread = new Thread(() => { CreateReport(); });
RunLengthyThread();
ShowReport();
}
}
And this is the function that deal with showing the wait form
private void RunLengthyThread()
{
WaitForm wf = new WaitForm();
this.Enabled = false;
wf.Show();
LengthyOperationThread.Start();
LengthyOperationThread.Join();
wf.Close();
this.Enabled = true;
}
Everything works as I wanted, except a few minor bugs like the MainForm not getting focus after the WaitForm is closed.
The problems I am facing and don't have a clue about are these -
1. The gif image does not animate. All I can guess is that the WaitForm window is also waiting for the main thread to join the LenghtyOperationThread before animating the gif.
2. I cannot figure out a way to return focus to the MainForm window once the WaitForm window closes.
Help me out? Please?
SOLVED
Thanks for pointing out the errors. Both problems are now solved.
Modified code follows -
private void RunLengthyThread()
{
WaitForm wf = new WaitForm();
Thread WaitFormThread = new Thread(() => {
WaitForm wf = new WaitForm();
wf.ShowDialog();
});
LengthyOperationThread.Start();
LengthyOperationThread.Join();
try
{
WaitFormThread.Abort();
}
catch{ }
}
UPDATE. DON'T DO WHAT I DID ABOVE. THIS CODE WILL GIVE YOU Threading and GDI+ exceptions randomly. I am not sure how, but this code also causes the application to slow down after a few hours. Memory and processor usage will remain minimal, as seen in task manager or process hacker.
New code is posted below. Long story short, use a backgroundwoker.
modified 2-Mar-13 1:26am.
|
|
|
|