|
Thanks - it was very fast
|
|
|
|
|
Hey howzit?
I have a Panel that displays 3 different photos as BackGroundImage's. One is 300dpi, 150dpi and 72dpi. Each photo causes the Panel to autosize.
I am using this as a zoom mechanism. So when the user clicks zoom, the image changes from 72dpi to 150dpi and 150dpi to 300dpi and that works fine, BUT i want the the scrollpositions of the form to change so that the area where the cursor is located on the image, is displayed in the middle. Similar to how we zoom to a specific spot in MS Word, i have used the code below but it doesn't seem to be very acurate, perhaps there is a way to achieve this specific position zoom in another way?
form.AutoScrollPosition = Cursor.Position;
Thanks!
|
|
|
|
|
Respected sir
my name is vivek deshpande.
i want to build one application in visual C#.net.
i know ADO.NET connectivity in Excel and also Access.
i want to transfer data from excel sheet to access table.
column name may be different.
for example in excel suppose their are fields such studName,studAddress
and in access fields such as Name,Address
then all data from studName should be transfer to Name in access database.
also all data from studAddress should be transfer to Address in access database.
if both database are very large then form size should be vary
we should map it automatically.
please tell me how to do this.
if any code available on net then tell me.
i hope u provide best solution in C# code as early as possible.
have a good day
yours
Vivek Deshpande
|
|
|
|
|
hi..
This is the same task what am too doing..
First,Do get the schema information of Source and then the data....
Now fetch the mapped columns data and schema....
In case of Access to Excel..Fetch the range of the target(excel) against which your source data is to be transferred and then set the Format of the cells depending upon the source column's datatype(if needed alone)..
Then use the usual adapter's Update(DataTable) to update ur Target database by using the datatable which contains the source table data....
If this is your need,feel free to askme further queries...
Hope you could have got atleast a small idea of what u have to do...
|
|
|
|
|
Hi friend,
The coding part is little vast since am using it in my project...
Anyway,i'll try my best to cut-short it and send you...
Also,a kind request,let ur responses and reply be sent to Codeproject site..'coz there may be many people who are like us searching for a solution...May be,the ideas we share help them...
Keep trying...
All the best
|
|
|
|
|
I have two classes, one running on a seperate thread. The one class writes to a table in a database and the other reads and writes to the same table in the database.
The class that only writes to the table is on a seperate thread.
The class that reads and writes to the table is on a timer. So every 5seconds it checks a boolean value and if its true it updates a listview.
The problem comes in when both classes tries to access the table at the same time, I get an error that the connection is currently open and busy.
How can I lock the method that loads the data from the table until the one class is finished.
Then the other problem will be. The main idea behind this is that two machines running the same app can use one database. how do I check if the other machine is currently busy on that table?
Any help and ideas will be appreciated.
Thanks in advance
|
|
|
|
|
What about using different connection instance of Connection class !!
i.e,
SqlConnection myConnection1 = new SqlConnection(.....);
SqlConnection myConnection2 = new SqlConnection(....);
Now, use myConnection1.Open() , myConnection1.Close() ...etc in One thread,
use myConnection2.Open(), myConnection2.Close() ....etc in another thread,
I am just thinking, I did not test it.
|
|
|
|
|
|
Please let me know if that solution is working. Because one of my current project will need simultaneous operation on a SQL file from two different thread, and I have just developed this algorithm.
-- modified at 1:43 Thursday 23rd February, 2006
|
|
|
|
|
lock(x)
{
DoSomething();
}
What the lock statement does is wrap an object known as a mutual exclusion lock, or mutex, around the variable in the round brackets. the mutex will remain in place while the compound statement attached to the lock keyword is executed. While the mutex is wrapped around a variable, no other thread is permitted access to that variable. If the next thread to gain to gain the time slice attempts to access the variable x, acceess to the variable will be denied. Instead, Windows will simply put the thread to sleep until the mutex has been released.
The above was quoted from "Professional C# 3rd Edition". They also say you must just be aware of deadlocks
Hope that helps you, works perfectly for what I need.
|
|
|
|
|
lock(x) is great, but in your case you should be allowing the database to decide locking, and use 2 connection instances.
|
|
|
|
|
Hi,
In my C# Windows application, I am using so many gifs and jpgs from various website. Say like for Search Button, I searched in Google Image search and found some small search icons, I just downloaded and used. Now Is there any copyright problem I may face When I will publish this software for retail distribution ? Or may any one sue me just to use those images ?
Emran
|
|
|
|
|
Hi!
Yes, you could run into copyright issues there.
You should assume that every image you find on Google image search is copyrighted by the owner and that you are not allowed to freely use it.
I guess some standard icons (for example, those usually used for save, cut/copy/paste, new document, etc.) can be used freely, but I can't draw a precise line what's ok and what isn't.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
No one can draw a precise line, as this is different from country to country.
|
|
|
|
|
emran834 wrote: Now Is there any copyright problem I may face When I will publish this software for retail distribution ?
Yes. You must obtain a license for each of the images. Some images are so common they appear to be free - such as the standard file-open/-save/cut/copy/paste however these too come with a licence from Microsoft (you get the redistributable licence with purchases of various developer products, such as Visual Studio)
emran834 wrote: Or may any one sue me just to use those images ?
Yes, the copyright holder. In most countries copyright is automatically assigned, even if the holder doesn't make it explicit. You can reuse copyright material under conditions of "fair use" (or "fair dealing" in the UK) but that refers to using only a small extract in, say, a critique of the work as a whole. I would doubt using a button image from one place as a button image in another would be regarded as fair use.
Bottom line: Find the copyright holder and obtain permission. There may already be a statement of putting the images into the public domain (which is an explicit act in most countries) in which case you can reuse the images already.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Thanks Colin,
I extremely appreciate you response.
Regards,
Emran
|
|
|
|
|
Is its possible that two processes in a computer write the information Simultaneously in one XML file(test.XML)
OR
I have to use Database
Please guide me if it is possible.
Ashwani
|
|
|
|
|
I read some where that the XML classes prevent concurrent writes to an XML file. However, you will have other problems. For example, if user "A" modifies one part of the document and user "B" modifies another part, either user "A" or "B" will lose his\her modification dependent upon who wrote to the file last.
|
|
|
|
|
Thanks,
My requirement is to only Insert the new records in a XML file( no modification, deletion)
Ashwani
|
|
|
|
|
You may loose inserted data too!
1. User A loads file.
2. User B loads file.
3. User A inserts data and saves it.
4. User B inserts data and saves it, and User A inserted data is lost.
|
|
|
|
|
Right !
Ok ! I was thinking what about accessing SQL database by Two Threads simultaneously !! I am planning to do something like,
[One thread is generating email address and email message and dump that record in SQL, another thread read email message from that SQL, send email and after that delete that record and scan any new record inserted]
A) Thread A inserts record in SQL
B) Thread B reads a record from SQL, may be the same one which was just inserted by Thread A.
C) Thread B do some work based on the information of that record.
D) Thread B Delete that record after finishing its work, and then look for new record again which was inserted by Thread A.
::: Now, Is there any chance of conflict ? I was worried about one thing, When Thread A is inserting record, does it lock the Database so that Thread B cannot read or delete any other record (not the exactly one which is being inserted) ? Or, When Thread B is reading or Deleting record, does it lock the database so that thread A cannot insert new record ?
Thanks and regards...
-- modified at 0:26 Thursday 23rd February, 2006
|
|
|
|
|
If you were back to the xml file thing, you could have a common write function used by the two threads, and a lock(this) at the start of the function so that the other thread cannot execute that method when one thread is inside it.
After every write into the file, you will have to save the file, so that when the next guy opens it, he will be appending to the already existing content of the xml file.
There has to be more to life than just this
|
|
|
|
|
Hello,
I understood about the XML file, but what about the SQL database file. Do i need to lock the database for similar operation ? Here I dont have multi user, but multi thread. I have two threads, one will insert record, another will read and delete record. at the same time, is there any chance of conflict and Hang ? Do I need to lock the database ?
|
|
|
|
|
If you are using independent connections as suggested already earlier, it all comes down to whether the database maintains integrity of transactions. Yes it does, that is why we pay so much money to use an Oracle or SQL Server database. If thread A is inserting a row into the database, the concerned tables will be locked and thread B will be made to wait before it can read or delete stuff.
So, yes, database is the most convinient method, albeit a tad slower.
There has to be more to life than just this
|
|
|
|
|
Something driving me insane that I cannot find in the options anywhere is how to turn of the auto-close functions so that when I type a quote like " I don't get another quote instantly. It drives me nuts. How can I disable that?
Thanks,
Rex
I only read CP for the articles.
Code-frog System Architects, Inc.
|
|
|
|