|
For your "mod",
<br />
double x;<br />
your_mod = x - (int)x ;<br />
For the second part, you want Math.Ceiling
|
|
|
|
|
Hi,
Is it possible using Enterprise Library Logger without any changes to default app.config?
I still want to store Logger configuration into the config file, but I need to setup the path to this file in the code
Thanks
Stas
|
|
|
|
|
Honestly I found the log4net API an incredibly easy solution for our clients. Give that a try
|
|
|
|
|
Yeee... I've done it using Enterprise Library. Here is the code:
<br />
FileConfigurationSource fileSource = new FileConfigurationSource(@"ProductApplication.config");<br />
LogWriterFactory factory = new LogWriterFactory(fileSource);<br />
LogWriter writer = factory.Create();<br />
<br />
LogEntry entry = new LogEntry();<br />
entry.Message = "test";<br />
entry.Severity = System.Diagnostics.TraceEventType.Information;<br />
<br />
writer.Write(entry);<br />
|
|
|
|
|
Hi, I'm first time here...
And I'm looking for a litle help...
I use NHibernate...
My applicetion doesn't work properly without some xml files. How can I include xml files at setup witch I created with ClickOnce?
miljan
|
|
|
|
|
If you are worried about you xml mapping files you might need to make sure they are set "Copy to output directory" in the project options. You will need to make sure nhibernate can read the mapping configuration.
Otherwise check my signature for a more robust solution that doesnt involve the xml configs
|
|
|
|
|
I solved my problem. Thank you very much, you help me a lot
miljan
|
|
|
|
|
I have this “search” control which is dropped on a good 2 dozen or so forms in a CE app.
There are possibilities of the control performing 3 different searches… sometime only 1, maybe 2, or even all three.
The user can select which one to start with from a combobox… if they choose the wrong one (no results come back) the control will move on to a different search.
For ascetics, I have a label in front of the textbox that will display whatever was selected in the combobox.
Here comes my problem… the control performs the first search, nothing comes back, it starts a different search… befor that search starts, I change (er, try to change) the value in the combobox and the label to reflect the current search.
The label won’t change until after the search is completed… like 4 methods and 20 some lines of code later:
private void IndexChange(string index)
{
switch (index)
{
case "Item":
lblSearch.Text = "Item:";
cmbBy.SelectedIndex = 0;
break;
case "UPC":
lblSearch.Text = "UPC:";
cmbBy.SelectedIndex = 1;
break;
case "Vendor":
lblSearch.Text = "Vendor:";
cmbBy.SelectedIndex = 2;
break;
}
this.sh.SearchParametersList.Clear();
}
The part that I’m totally not getting is that if I through in a MessageBox beneath the lblSearch.Text lines, it works as I want it to:
private void IndexChange(string index)
{
switch (index)
{
case "Item":
lblSearch.Text = "Item:";
MessageBox.Show("lblSearch should show\"Item\"");
cmbBy.SelectedIndex = 0;
break;
Why does the combobox change when its told to but, the label refuses to listen to me?
|
|
|
|
|
Hi,
everything a Windows app does is event driven, which means there is an input queue,
a lot of messages, and a "message pump" which fetches messages form that queue
and acts on them. Your button click turns into a message, and the message pump
calls your click handler; as long as you are executing inside your click handler
your message pump is waiting for you to finish, before it can process the next
message; that's why the label update seems late.
There are three ways to escape from this:
- showing another modal form (such as MessageBox) launches a new message pump;
of course that is not the right solution, it just explains how it seems to help.
- adding Application.DoEvents() causes the immediate handling of all messages
currently in the queue; this may or may not solve it, it typically does for
simple situations.
- using another thread: this is the general solution for situations where you
want the GUI to be alive while your app is still working on something; it comes
at a cost: you need to set up communications between the main thread and the
new thread, and, the new thread is not allowed to touch your Controls directly;
it needs to use Control.InvokeRequired and Control.Invoke; if you decide to
go this route, make sure to read up on it, and have a look at some examples.
So I suggest you try adding one or two DoEvents() inside your click handler.
And then read up on the different keywords I handed to you.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Fantabulous!
Application.DoEvents() did the trick for me.
I’m not 100% sure I fully grasp why, but I’ve nothing better to do this weekend than wrap my brain around this “message pump” thingy.
Thank you.
|
|
|
|
|
Hello UsielDR,
As Luc Pattyn mentioned in his message there are two ways to solve this issue.
1- Adding Application.DoEvents()
2- Multi-threading "Backgroundworker"
The Application.DoEvents() provides easy solution to simple things such as updating a label with the new text. This is good if you simply expect the user to sit and wait for the search to come back with the result. After all, the Windows Application will be busy dealing with the search job.
My advise is to use the Multi-threading for the search and not to stop the user from using other functions of the windows application. That would be very important when the search turns out to be a lengthy time consuming search. Using multi-threading also allows you to use some fancy stuff like adding a ProgressBar into the StatusBar inorder to show the user that the search is going on and alot more.
Here is a link for a Multi-threading example which I find it very usefully and provide you with lots of help and information.
http://msdn2.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[^]
I hope this information could provide you with some help,
Have a great day,
khoramdin
-- modified at 14:23 Friday 17th August, 2007
|
|
|
|
|
Hi, my first post here
I'm very new to C# but am familiar with C++. I'm wanting to make a very simple game that will have an XY grid (2d array), and I need it's graphical representation, I also want the "display" to detect where (according to the displayed grid) the mouse was clicked and put a dot on the nearest grid lines intersection (I think the array will be updated first according to the click position, and from there the visual version of it).
I was looking for relevant tutorials, but havn't found anything that resembles to what I'm looking for. Would appriciate a point in the right direction, thanx
|
|
|
|
|
Hi,
here are some basic concepts:
- Windows apps are event driven
- there are several Mouse events, such as MouseDown
- all painting should occur in the Paint handler
if any of these sound unfamiliar, you need to work your way through a book
on C#, then have a look at some of the CodeProject articles, maybe from the
C# games section (I did one on Sokoban).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
In the MouseDown event on the control, form, or whatever get the XY of the cursor.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I develop smart client application,that I need to export Microsoft local report to word format!
But already known that when developing application with win forms we use reportviewer but the reportviewer exports only image,excel and pdf formats!...so I need to export as word..
Heeeeellllp!
|
|
|
|
|
Have you started this task, if so, where are you having problems at? What SPECIFIC questions do you have?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
How to Build an independent 3 Tier Architecture,where i can change my Data Access Layer with out affecting Business logic layer
|
|
|
|
|
well gee, thats a great (and interesting) question but unfortunately its impossible to answer with a single forum post. We tend to answer questions about a specific piece of code in this particular forum.
You might try searching google for the exact keywords you used for the title of this (well named) thread.
Sorry I couldn't be more help.
Well wadda you know it is possible to answer these politely. live and learn.
|
|
|
|
|
J4amieC wrote: it is possible to answer these politely
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
The people in the lounge said I should google for the answer to a programming question but I do not know what search engine to use
|
|
|
|
|
Hi all,
i have developed a windows application where in i have to get the types defined in the assembly.But after loading the file and when i write
GetTypes(),
i get a error {"Could not load file or assembly or one of its dependencies. The system cannot find the file specified.} that i captured using LoaderException.
i tried searching out but didnt get any idea what exactly is happening.Plz somebody help me out,as i am badly in need of solution.
Thanks in advance.
Swarup
|
|
|
|
|
I helped someone with the same problem yesterday. First he pointed to a location other than where the dll was, and then he forgot to copy all the dependencies together with the dll. Maybe start by checking whether the dll exists in the given path and whether it can access all of its dependencies.
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|
|
Can anybody help me how to display messageboxes with in the client region insted of displaying them at the default centre location on the screen area.
Any help will be greatly appreciated
|
|
|
|
|
|
hello,
I am beginner in c#. in fact I would like to write a program which reads a file CSV and transfert in a table with 2 dimensions.
the CSV file is like:
100;SG;
111;SAS;
112;HR FT HU ;
.
.
.
and i would like to have a table like this
telephon user
110 SG
111 SAS
112 HR FT HU
.
.
.
can you please help me
thanks
|
|
|
|
|
Try string.split() to get the values out of each line.
If you need more help, please specify where that table should be drawn. (console, gui...)
|
|
|
|