|
Please stop cross posting. You've asked enough questions on the boards before to know the form. Pick the most appropriate forum, post your question and then wait for somebody to get the time to take a look at it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
But I need it very urgently pete. Sorry for troubling u all. But pls. try to help if possible. Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
I have been trying to use timers in VS 2005. I was under the impression when the tick event fired it was similar to a hardware interrupt . Time has shown I am incorrect, I am now using a separate thread.
My question is: what is happening when the tick event fires, is it sitting in a queue waiting for a break in the thread, is it lost if the thread is busy else where, or something else?
Thanks
Jim
|
|
|
|
|
That depends on which Timer is being used. There's 3 in the .NET Framework.
The System.Threading.Timer is a uses a callback delegate, which is executed on a Thread from the ThreadPool.
System.Timers.Timer is a server-based timer designed to work from worker threads in a multithreaded environment.
System.Windows.Forms.Timer is a event-based timer designed to work in a single threaded environment on the thread with your application message pump and relies on the O/S timer support.
The Timers.Timer and Forms.Timer both use events to signal the elaspe of the timer. The events are queued and must wait for the thread handling the events to get around to them.
The Threading.Timer uses a direct call to the code handling the elaspe of the timer. It doesn't have to wait for a thread to handle a queued event, but instead creates a new thread out of the ThreadPool and executes the method on that. The only thing that would slow that process down is if the ThreadPool doesn't have a thread immediately available to execute the request.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you for the good explanation.
Jim
|
|
|
|
|
I have made small testing app. Iniatialy I have used database connection via IDE (Data Sources -> Add New Data Source), later I have shifted my project to another PC so I had to change Data source.
I have removed old data source from IDE, attached database to another server and stored connectiong string in App.config file.
BUT when I tried to reach this information first time I found out there were more than one conn string!
Old one (which was never in App.config!) and new one.
My confusion was even greater because I haven't had .config file (nor -.settings) prior the change of data source.
Where is old connection string stored? It's not in App.config!
I made ad hoc solution for the moment, method shown passes first usable connection string:
<br />
public static bool ProvjeriKonekciju()<br />
{<br />
bool povrat = false;<br />
SqlConnection conn = null;<br />
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);<br />
ConnectionStringsSection section = config.ConnectionStrings;<br />
ConnectionStringSettings settings;<br />
<br />
for (int i = 0; i < section.ConnectionStrings.Count; i++)<br />
{<br />
settings = section.ConnectionStrings[i];<br />
if (settings == null) continue;<br />
<br />
conn = new SqlConnection(settings.ConnectionString);<br />
try<br />
{<br />
conn.Open();<br />
if (conn.State == ConnectionState.Open)<br />
{<br />
povrat = true;<br />
_ConnString = settings.ConnectionString;<br />
povrat = true;<br />
break;<br />
}<br />
}<br />
catch (SqlException sqlex)<br />
{<br />
Debug.WriteLine(sqlex.ToString());<br />
}<br />
catch (Exception ex)<br />
{<br />
Debug.WriteLine(ex.ToString());<br />
}finally<br />
{<br />
conn.Dispose();<br />
}<br />
}<br />
return povrat;<br />
}
How can I eliminate the intruder?
I'm using Visaul C# 2005 Express.
Help.
I'm not native English speaker, so excuse me.
Feel free to point out bad code aswell.
|
|
|
|
|
Help please!
|
|
|
|
|
Connection strings can also be stored at the machine.config level. So if you are seeing another connection string it can be from there.
A better way to access the connection string if you are using .net 2.0 would be to get it from the ConfigurationManager.ConnectionStrings. This should be only the value you have set in the app.config file. When you open the configuration file like you have in the above code it may be looking into the machine config as well.
Hope that helps.
Ben
|
|
|
|
|
No. That was my first choice, but it also has sent me two connStrings.
I thought code shown above will help me (well that was the idea I got after reading msdn).
|
|
|
|
|
Sir,
I got these two exceptions, 1. System.Runtime.InteropServices.GUIDAttribute - cant be specified multiple times and
2. System.CLSCompliantAttribute - cant be specified multiple times with Indentical parameters also.
Why do I get these exceptions and how can I clear these exceptions. Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
I'm guessing you have a GUIDAttribute and a CLSCompliantAttribute specified more than once for a class? The clue is in the error message.
|
|
|
|
|
But I am not getting how should I clear it. Pls. give me some example how to clear that error. Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Obviously, if the error says 'don't specify this multiple times', you need to only specify it once, whereas you're currently specifying it MORE than once.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus - Pointing out the blindingly obvious to those that refuse to see it since 2000!
|
|
|
|
|
Both of these attributes are generally specified in the AssemblyInfo file. This file is included only once in the project, so the attributes are defined only once. The attributes do not exist in this file by default, so you would need to add them.
If you think these are defined more than once (which the compiler obviously does), then search using "Find in Files" for the attribute names and remove the duplicates.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Are you not perhaps specifying class targeted attributes on methods?
|
|
|
|
|
Hi,
Is it possible to set the load order for the windows service? So for example, I want to have my windows service loaded last after a system boot up. Is that possible? Thanks for and any replies.
~Jacky
|
|
|
|
|
I don't know of any way that you can force a service to load last, but you can set a dependency on other things. I had an issue where the Message Queue MSMQ needed to load first before my service.
In the ServiceInstaller file you add this:
this._serviceInstaller.ServicesDependedOn = new String[1] {"Message Queuing"};
So if there are other services that need to be running first. Just put there name in the above code instead of the "Message Queuing".
Hope that helps.
Ben
|
|
|
|
|
There used to be some Netscape Browser lines in machine.config. I am not able to locate them in .NET Framework 2.0 machine.config.
Any clues?
|
|
|
|
|
Hi,
I have this problem on closing sockets. When my server initiates it listens request through a tcp port like so...
tcpChannel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(8005);
Now, when my server shuts down and then restarted. It gives me this error,
"only one usage of each socket address (protocol/IP address/port) is permitted."
It seems the port is not closed or there is a timing issue.
The Solution:
So to fix this, I want to scan the socket 8005 and see if its closed or not before my server starts. If it is open, then close it. My server runs on a window service so it can do this. It seems I only have this problem for dual core processors. Other processor worked fine.
So does anybody know how to implement this solution in C# code?
Thanks in advance for any help!
~Jacky
|
|
|
|
|
Hi,
i am working in a Web application, which is using the Setup to install in a system, now i have to customize the MSI Application, for new different cases by using a radio button,i am new to MSI programming possible if so any please send me any resource
Thx for u r help in advance,
|
|
|
|
|
|
I am working on a composite DateTime picker control.
I would like to expose a ValueChanged event when the composite value changes.
Internally, I handle the DateChanged and TimeChanged events.
Private Sub DatePicker_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DatePicker.ValueChanged<br />
If Not bInternal Then<br />
CombineValues()<br />
End If<br />
End Sub<br />
<br />
Private Sub TimePicker_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimePicker.ValueChanged<br />
If Not bInternal Then<br />
CombineValues()<br />
End If<br />
End Sub<br />
<br />
Private Sub CombineValues()<br />
Dim dt As Date = DatePicker.Value<br />
Dim tm As Date = TimePicker.Value<br />
<br />
Dim s As String<br />
s = String.Format("{0} {1}", dt.ToString("d"), tm.ToString("t"))<br />
_date = Date.Parse(s)<br />
End Sub
He was a snowflake, like other "unique" snowflakes, falling down, getting stepped on, and pushed aside to disappear.
|
|
|
|
|
You can create a custom event for your composite control. The subject of creating custom events is a little confusing and lengthy. Check out this article on creating events:
http://www.codeproject.com/vb/net/StepByStepEventsInVBNET.asp[^]
Once you've declared your event to be public you can expose it outside you control just like any other control.
Cheers!
Richard
May your code be error free
|
|
|
|
|
Thanks. I'll check that out.
He was a snowflake, like other "unique" snowflakes, falling down, getting stepped on, and pushed aside to disappear.
|
|
|
|