In a C# 2010 desktop application, I want to change the application so that it will only allow users to select a
report that meets the following criteria:
1. part of the file name is "ErrorReport" and
2. The last node of the file name is .xlsx or .xls.
This code works when I am selecting only excel (*.xls or *.xlsx) files.
The problem occurs if the user selects a .pdf file iniitally and there is actually a file in the directory path
that meets the criteria I listed above. The code will ignore the .pdf file the user selects and will actually use the
excel file that is in the directory path.
Thus how can I change the code listed above to say the .pdf file is invalid?
Is there such a thing as 2 way events? OR maybe I am doing this wrong. My form is making a call to a dll to submit a form and logon to a web site if required. The dll all of a sudden needs more information that wasn't thought it would need prior so it wants to ask the user for more information and then continue when it has it. I have searched around for 2 way events with no luck. I started to make an event that calls back to the form and then the form calls back with the new information to a continuation event but then I started to realize that there are issues with this such as another function called the logon function and the form doesn't know about that. Obviously I could track that as well. In any event I would like to know if I am doing it the wrong way.
Events are always "2 way", meaning they are raised and returned.
Maybe you are getting terms mixed up, you don't call functions by using events (or if you are, its not the right design). You should have a way of validating your user input before pushing up the call stack to the DLL to make sure you get everything you need.
Can you give a specific scenario? Here's how it reads to me:
Your application asks me for some information, like username/password. I give it. You pass it to the DLL to submit some information to a web-site and this DLL needs additional information to complete the call, like saying "not registered, please create an account". You need the additional account information so you ask the user for it and call again.
In that case, I would expect that the DLL function returns something that says it needs more data. You simply ask the user for it, and re-submit to the same function. If you are subscribing to an event in the DLL that says "succeeded" "failed", or "additional info" then it really is a violation of programming principles since how are you supposed to match up a function call with a request if you have multiple happening at the same time?
I guess I would need more information to be able to suggest a good course of action here, is the DLL yours or third party?
Events are alwyas "2 way", though they are never described as such.
There is always an event provider and one or more subscribers to that event. The event usually passes the source of the event (usually as Object) and some kind of EventArgs object. What you may not realize is that you can modify the Eventargs object passed to your event handler. When the event handler code goes out of scope, the event provider gets control back and can look at the data that is in the EventArgs object it sent to the handler. For an example of this, see Form_Closing and it's FormClosingEventArgs class. In there, you'll find a Cancel property that the handler code can set to cancel the form being closed.
Another example is KeyPressEventArgs and its Handled property.
I have a C# 2010 console/desktop application that obtains its own database connections from its app.config file. This application adds a reference to a dll so that it can access another C# console/windows application.
The main C# 2010 console/desktop application needs to be able to access the database connections of the program that is called in the dll. The database connections of the called program are stored in an app.config file.
Thus can you show me code or explain to me how the main C# 2010 console/desktop application can obtain the database connections stored in the app.config file for the program that is accessed by the dll?
I want to pass a boolean value to an oracle parameter .My doubt is how to create .net oracle parameter for a boolean data type and pass that value. Even entity framework is not supported for stored procedures with boolean parameters
That is not the case. SPs are already written and unfortunately we can not change it This is the issue
The function 'SP_GBM_AUDIT_FIELD_ENTRY' has a parameter 'BCHECK' at parameter index 5 that has a data type 'pl/sql boolean' which is currently not supported for the target .NET Framework version
I have created a gridview to display the database in the ASP.NET application. I have formed a dropdown box to which data is bounded.
I want to see the data displayed in the boxes as I select a name field from the drop down box.
Please tell me how to do this.
P.S.-I am a Beginner.
I have created WCF Rest Service Application using Visual 2010 an year ago. Now I need to use DBGeometry class in the service. But the Rest Service throws an exception (Bad Request) when I use DBGeometry. So I want to create a new WCF Rest Service application using visual studio 2012. Unfortunately there is no WCF Rest Service Application template in Visual Studio. I tried to create WCF Rest Service Application using Blank Solution in Visual Stdio 2012 , but could not get to work. Is there any template or any other ways to create WCF Rest service app in Visual studio 2012.
I know I can use ASP.Net MVC 4 and Web API template... but it's too much work, since I need to create controllers , etc for all my Rest service methods...