|
Henry Minute wrote: For controls with no user interaction (Labels for example) it does not matter what you do with TabIndex since it is ignored
Not quite: If there is a shortcut key associated with the label, then it will activate the next control in the tab order. E.g. label1.TabIndex = 5, textBox1.TabIndex = 6, with label1.Text = "&Hello". ALT+H will move the input to textBox1.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
True. I had forgotten that since I rarely use that functionality.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Interesting. So early and I already learned my new thing of the day. Thanks.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
how can i declate a array of string without defining the amount of array.
Something like this.
String[] strArray = new String[];
Help plz!
|
|
|
|
|
The short answer is you can't.
You can do String array; and then later say array = new String[10]; but I doubt that's what you're looking for. If you don't know at compile time the size of your collection, go for a List<String> .
Cheers,
Vikram. (Got my troika of CCCs!)
|
|
|
|
|
You cannot.
There are two ways to declare an array.
One is as is mentioned in the first post.
The other is to define your contents within the array right from the start - string []a = new string[] {"1","2","3"};
|
|
|
|
|
so is it possible to convert List to array string I mean (List ==> String[])
|
|
|
|
|
yes.
it is also possible to read the documentation on a very interesting class.
you may discover some advantages of lists over arrays.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
As stated on above comments, you cannot. I assume you need what you need because you don't know the number of indices. If so you can workaround it. Use an ArrayList and populate it with your data then you can return it as a string array using its ToArray() method. Check this article.
Best regards,
Anıl Yıldız.
|
|
|
|
|
You may be able to do something like this?
String[] strArray = null;
Int strArrayLength ;
strArray = new string[strArrayLength];
|
|
|
|
|
|
my connection is:
<add name="AdNetConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=AdNet;Integrated Security=True" providerName="System.Data.SqlClient" />
the error is
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
and I try to add the proberty
ConnectionTimeout=200
to my connection but this error occurred
The Connection Timeout attribute is not declared.
so please guide me to solve this problem.
|
|
|
|
|
msomar wrote: Timeout expired.
Your query is to slow to complete only for 200 seconds.You would better try to optimize it.
If your query execution time can't be reduced set ConnectionTimeout property to 0, which means no limit.It's preferred to be avoided but sometimes it's not possible.
Life is a stage and we are all actors!
|
|
|
|
|
Can you post a bit more of your code? I suspect that your connection string isn't right, as the server should respond in 200 mS easily. Are you using a local installation of SQL Server Express? If so, it should have a name for the instance, not ".\SQLEXPRESS." It may be that it isn't responding because it's never notified on the request. For instance, on my setup, the SQL Server installation is named "BAAL\SQLEXPRESS" and shortening the name in the connection string never works. The shortcut ".\" may not be valid for this application, so try adding the full name of the computer that hosts the server and see if that helps.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hello,
I can write code to read and write to excel and word.But I face problems with versions.A certain version works at my end and doesnt work at the client end.
I have included Microsoft Excel 12.0 Object Library at my end and found that the client didnt have this library .He had Microsoft Excel 5.0 Object Library .So I coded According to version 5.0 but still at the client end I am getting the error saying the Interop file doesnt exist.It works fine with me.
Can you tell me how do I nail down version problems and Is the COM coding for Microsoft Excel Word different for different versions.
Thanks
Pritha
|
|
|
|
|
prithaa wrote: saying the Interop file doesnt exist.I
If your code creates an interop file, that file needs to be available on your client's system.
My signature "sucks" today
|
|
|
|
|
Thanks for your reply
Which files do I need check ? I am sending the exe file of my working project.
Pritha
|
|
|
|
|
Have a look in the bin folder. Do you see any interop files?
If yes, then you would need to include them along with your exe.
My signature "sucks" today
|
|
|
|
|
Excel 5.0 came out 'way back in 1993 IIRC... I wouldn't be surprised if you had some trouble getting it to work - there aren't any Primary Interop Assemblies for it and working with it directly through COM can be iffy. If your Word and Excel files are not too complex, I would advise you to use NPOI[^] to read from and generate the files. NPOI does not depend on Word or Excel in order to work - so there are no version problems, and you don't even have to worry if the machine your code is running on even has Office at all. It supports formatting like fonts, font styles, colors, tables, formulas, col and row sizing and autosizing, document properties, etc.
|
|
|
|
|
Hello,
Yes I have Interop files
Interop.Excel.dll
Interop.Microsoft.Office.Core.dll
Interop.Microsoft.Office.Interop.Excel.dll
Interop.VBIDE.dll
I should send all these files alongwith exe
thanks
|
|
|
|
|
In the following code, which I have found to be common practice amongst the examples I have found on the web, the WebRequest class is instantiated like it's a regular class yet it's an abstract class. Underneath the hood, the http object is a really a HttpWebRequest object, but doesn't this defy the principle that you cannot instantiate abstract classes through it's syntax? This is the line that doesn't make sense to me: WebRequest http = WebRequest.Create(url);. WebRequest (abstract class) is being instantiated as object http. If the underlying class that is being instantiated is the HttpWebRequest than shouldn't that only be allowed?? such as HttpWebRequest http = HttpWebRequest.Create(url)?
class ScanUrl
{
public StringBuilder Scan(String u)
{
StringBuilder sb = new StringBuilder();
Uri url = new Uri(u);
WebRequest http = WebRequest.Create(url);
WebResponse response = http.GetResponse();
int count = 0;
String key, value;
for (count = 0; count < response.Headers.Keys.Count; count++)
{
key = response.Headers.Keys[count];
value = response.Headers[key];
if (value != null)
{
if (key == null)
sb.Append(value + "\n");
else
sb.Append(key + ": " + value + "\n");
}
}
return sb;
}
}
|
|
|
|
|
Jeff Kissinger wrote: the WebRequest class is instantiated like it's a regular class
Not, it's not. The WebRequest class exposes a static method (no instance required!) that creates an instance of HttpWebRequest, which inherits from WebRequest. Since the returned object inherits from WebRequest, you can use the WebRequest methods and properties since they are implemented by the HttpWebRequest class.
Jeff Kissinger wrote: but doesn't this defy the principle that you cannot instantiate abstract classes through it's syntax
No, since you're not instantiating the WebRequest class. Your instantiating an implementor of it, namely HttpWebRequest.
Jeff Kissinger wrote: If the underlying class that is being instantiated is the HttpWebRequest than shouldn't that only be allowed??
Read up on inheritance. You can treat the returned object as any type in its inheritance chain, all the way up to System.Object. The interitance chain for HttpWebRequest is:
System.Object
System.MarshalByRefObject
System.Net.WebRequest
System.Net.HttpWebRequest
|
|
|
|
|
And read up on the Abstract Factory and Factory Method design patterns.
|
|
|
|
|
Thanks, both of you for your great answers and cluing me in on the Abstract Factory. I've never heard of the Abstract Factory in the official Microsoft courses that I took. After finding some books and websites on this topic yesterday, I was able to understand the implementation. I have to say the topic isn't listed in most C# .NET books and when it was present, it was pretty vague.
I found it in sufficient detail in the following books:
O'Reilly - C# Design Patterns 3.0
Apress - Pro .NET 2.0 Code and Design Standards in C#
If you know of any other great resources, please let me know.
Thanks!
|
|
|
|
|
Almost in every site that I searched today, it is advised that BeginSend is more efficient on server than having a separate thread for each connection.
MSDN on the other hand says:
"When your application calls BeginSend , the system will use a separate thread to execute the specified callback method"
Now if each call will create a new thread, how is it more efficient than having just one thread available for send?
Thanks a lot in advanced.
"I hope you live a life you're proud of. If you find that you're not, I hope you have the strength to start all over again." - I wish I knew who is this quote from
|
|
|
|