|
Hi all,
Weird problem: When I set focus to a scrolled control, it resets the scroll position to (0, 0).
This happens with three different methods for setting focus: Focus (), Select (), and setting the parent's ActiveControl.
Resetting the correct scroll position after setting focus doesn't work: The scrollbars disappear!
MSDN doesn't even mention this phenomenon. A solution is proposed here http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/437437c8-9548-4e68-8f17-356f848f379d[^] but has no effect for me.
Any suggestions how I can set focus to a control without screwing up the scroll position? Thanks!
|
|
|
|
|
I presume this control has items such as ListViewItem. I hope you do not force it to refresh any items in it
|
|
|
|
|
That solution works for me, I really appreciate you post that link.
Diffy
|
|
|
|
|
I have an app that needs to read in excel files. However the users keep leaving them open, so I want to
save changes and close them. I have no read experience in WinAPI in C#. Could someone help?
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
simply kill the Excel process, or shutdown the system, or disconnect the power cord, each time this happens, and until the users have learned it doesn't make any sense to enter data and not save it.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Well, golly gee, you DO have good ideas.
Everything makes sense in someone's mind
|
|
|
|
|
yust make sure you detect excel is opend and if it is, promp it to users to save changes and close
|
|
|
|
|
Yes, but HOW??
I'm looking for the code to automate this.
Everything makes sense in someone's mind
|
|
|
|
|
|
i developed two websites in asp.net (c#)
they should send info to each other
please some one help me in sample code about that
|
|
|
|
|
Considering there are innerable ways to do this, it's impossible to tell you what you need to know. You haven't provided ANY details at all on what kinds of app these are, what the data is you intend to share, where it's stored, if they share a common data store of some kind, if the apps are on the same server or on different servers, if you need real-time communication between the two, if the transfer needs to be ecapsulated in a transaction of some kind, ... on and on and on.
Basically, noone can answer your question as asked.
|
|
|
|
|
thank you for your reply
i really think about HTTP request
assume that first sever collect the information from table in database that he (the first server) owns rearrange it and send it to the second server the second will receive that date and update its database that exist on it (owned by second) upon to that data
data could be sting , text , int ...
|
|
|
|
|
Check into writing a web service and installing it on the second server.
|
|
|
|
|
|
Hello,
How we can define a table of array list in an function, i try for :
public ArrayList[] stringArray = new ArrayList[2];
public static ArrayList Tbl = new ArrayList();
public static ArrayList Tbl2 = new ArrayList();
public stringArray verification(string path, string path_save)
I would define a type stringArray.
thank you verry mutch.
|
|
|
|
|
I was going to say "I don't understand what you want", but on second thoughts:
Are you trying to return an ArrayList as the result of the verification method? if so, then decalre it as
public ArrayList[] verification(string path, string path_save) and it should work.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
How we can define a array of array list? thank you verry mutch.
|
|
|
|
|
abbd wrote: How we can define a array of array list?
how do you define an array of int?
how do you define an array of Object?
why do you think it would be any different?
And why are you using old ArrayList rather than generic List<T>?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Are tere a difference between List<t> and ArrayList, i would define an array of arraylist of string. thank you verry mutch.
|
|
|
|
|
As i saw in msdn, ArrayList holds only String Objects, while List can use any type including custom class, struct and so on
|
|
|
|
|
Saksida Bojan wrote: As i saw in msdn, ArrayList holds only String Objects
you either need a new MSDN or (new) glasses.
ArrayList and List<object> are rather similar; the bad thing about ArrayList is it could contain just all kinds of things, i.e. it isn't type safe.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Please stop asking elementary questions to which a simple MSDN page would provide adequate answers.
you urgently need to learn how to help yourself. with a book, Google and MSDN.
please study and learn, rather than ask and not learn.
thank you extremely much.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Very simple - just the same as you would for anything else:
private void button1_Click(object sender, EventArgs e)
{
ArrayList al = new ArrayList();
LoadList(al, 0, 3, 1);
ShowList(al);
ArrayList[] all = new ArrayList[2];
all[0] = new ArrayList();
all[1] = new ArrayList();
LoadList(all[0], 10, 13, 1);
LoadList(all[1], 0, 300, 100);
foreach (ArrayList a in all)
{
ShowList(a);
}
}
private void ShowList(ArrayList al)
{
for (int i = 0; i < al.Count; i++)
{
Console.Write(" " + al[i].ToString() + " ");
}
Console.WriteLine();
}
private void LoadList(ArrayList al, int start, int end, int increment)
{
for (int i = start; i <= end; i += increment)
{
al.Add(i.ToString());
}
}
However, I would suggest that rather than an ArrayList, use a List<T> - the usage is very similar.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I Don't know how array list works, but i woud youse List from System.Generic namespace
public List<ArrayList> lst = new List<ArrayList>();
lst.Add(new ArrayList());
also you cant use name of variable with a type of Arraylist as return value for function. If you want to have specific name for return value, you could use STRUCT.
As I said, you can't have the name of variable as return value
public stringArray verification(string path, string path_save)
this is how should be done
public ArrayList verification(string path, string path_save)
{
return stringArray;
}
Edit: Some tags needed to be converted, so that it woudn't brake view
modified on Thursday, October 15, 2009 2:28 PM
|
|
|
|
|
Hello,
I'm writing a C#/.net3.5 application with VS2008 Pro, and I just found today that there is a problem opening a file for writing when the file already exists. I tried to reverse to old revisions with SVN, but the problem is still there.
The user can choose to open a file named, for example 'file.ext'. The file is read through a StreamReader and ReadToEnd() method. Once it's done, I call the Close() method on the StreamReader. I check if a second file, name 'file.rak' (that holds more information) exists, and if so, it's open with the same method as the first file. The name of the first file is stored in a class in the application. Both files have same structure.
Saving the file is made with a StreamWriter. I first open the file, then write my data with the Write() method, and I close it, with Close(). After the first file is written, I call the same method to write the second file. The problem is when I try to open the second file for writing (still with StreamWriter), I got an exception saying access to the file is denied.
I tried to see with Process Monitor the operations on the file, but we can see it's well closed after reading is done.
Any clue ?
Thanks !
Fred
|
|
|
|