|
shamidi wrote: I want to simply have the second application edit the same file. Is this possible?
Nope. Excel sheets can only have one writer at any one time. Any attempt by other Excel instances to open the sheet will result in a ReadOnly warning.
A better way to do this would be to use an actual database engine, like Access or SQL Server or MySQL.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Basically ---
I'm looking for a way to edit an already opened excel file. Is this possible??
Please help!
Sherwin
|
|
|
|
|
Once again - No. It cannot be done using an Excel object.
Excel does not have the ability to merge changes from multiple sources at the same time. If you got multiple instances to open the same workbook, then both apps made different changes to the workbook, the last one to save it's changes wins, completely overwriting everything else that was changed in previous saves by the other copies of the app.
So, if Instance1 opened the workbook and Instance2 open the same workbook, both instances would have their own copy of the data. Now, if Instance1 changed cell A1 and Instance2 changes cell B1, then they both saved, but Instance2 saved last, the only change you'd see in the workbook would be that to cell B1. Cell A1 wouldn't have changed from the original workbook.
Use a real database engine and if you need that data in an Excel sheet, have a tool that exports the data into a workbook so you have a point-in-time copy of the data in Excel.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Anyone can help me to get a number of position from coordenates x, y?
i.e:
We have:
1 2 3
4 5 6
7 8 9
that are, in coordenates (x,y), (1,1), (1,2),...(3,3).
What I need is associate an index, where each position corresponds with the number I put before; that's it: (1,1) = 1, (1,2) = 2, ..., (3,3) = 9
Regards,
Diego F.
|
|
|
|
|
I forgot to say that I now that x axis is always 3, but y axis can change.
I can have
1 2 3
4
or
1 2 3
4 5 6
7 8 9
10
etc.
Regards,
Diego F.
|
|
|
|
|
Ok, the solution is 3*(X-1) + Y
Regards,
Diego F.
|
|
|
|
|
hi all
i want to update my application with a prompt for that.
i found Clickonce is very good, and tried alot to understand,
see could able to publish and make the new versions,
but my requirement is whenver user opens my applicaions and connected to internet i need to promt him saying u r working with olderversio(1.0 and current version 3.0 is available)
if user clicks ok it should be updated please
help me how to do so
thnx in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
This info must be available in lots of places, but here it goes (in short)...
To publish the initial application:
1. Right click on the Project in solution explorer. Click Properties. Click the Publish tab.
2. Enter the location you want to publish to in 'Publishing location'
3. Click the 'Updates' button.
4. Check the 'Application should check for updates' checkbox.
5. Check the 'Before the application starts' radio button.
6. Click OK to close the dialog.
7. Back on the main screen, select 'The application is available offline as well'
8. Enter your initial publish version under 'Publish Version'
9. Click the 'Publish Now' button.
To publish an update:
If you want to publish an optional update, just increment the 'Publish Version' and click the 'Publish Now' button. When starting the application the user will be prompted if the update should be installed. The user has the option to skip the update.
If you want to publish a required update, increment the 'Publish Version'; then, click the 'Updates' button. In the dialog, check the 'Specify a minimum required version for...' checkbox. Enter the same version you just entered in 'Publish Version'. Click OK to close the
dialog. On the main screen, click the 'Publish Now' button. The update will automatically install as soon as the user starts the application.
Hope this helps,
Roel
|
|
|
|
|
Thnx alot Mr.Roel
I found ur help on click once is useful, but here i have a doubt about my current Error: INVALIDDEPLOYMENTEXEPTION, saying "Application in not installed"
Here i have taken a button[Update] and when user clicks the buttion the functionality should checks the updated version and if available it should download the latest version for that my code is,,
in Buttion
private void button1_Click(object sender, EventArgs e)
{
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;
bool update = appDeploy.CheckForUpdate();
if (update)
{
UpdateCheckInfo updateInfo = appDeploy.CheckForDetailedUpdate();
string version = updateInfo.AvailableVersion.ToString();
bool updateRequired = updateInfo.IsUpdateRequired;
string minVersion = "";
if (updateInfo.MinimumRequiredVersion!=null)
minVersion = updateInfo.MinimumRequiredVersion.ToString();
bool updateAvail = updateInfo.UpdateAvailable;
long footprint = updateInfo.UpdateSizeBytes;
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Update Version: {0}\r\n", version);
sb.AppendFormat("Minimum Version: {0}\r\n", minVersion);
sb.AppendFormat("Update Required: {0}\r\n", updateRequired);
sb.AppendFormat("Update Available: {0}\r\n", updateAvail);
sb.AppendFormat("Update Footprint: {0} bytes\r\n", footprint);
MessageBox.Show(sb.ToString());
if (updateAvail)
{
bool updated = appDeploy.Update();
if (updated)
Application.Restart();
}
}
else
MessageBox.Show("No updates are available.");
}
else
{
MessageBox.Show("This application was not launched using ClickOnce. Cannot perform update.");
}
}
in PageLoad
private void Form1_Load(object sender, EventArgs e)
{
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;
this.label1.Text = appDeploy.CurrentVersion.ToString();
appDeploy.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(appDeploy_CheckForUpdateProgressChanged);
appDeploy.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(appDeploy_CheckForUpdateCompleted);
appDeploy.UpdateProgressChanged += new DeploymentProgressChangedEventHandler(appDeploy_UpdateProgressChanged);
appDeploy.UpdateCompleted += new AsyncCompletedEventHandler(appDeploy_UpdateCompleted);
}
}
void appDeploy_UpdateCompleted(object sender, AsyncCompletedEventArgs e)
{
string s = String.Format("UpdateCompleted canceled?{0}, sender: {1}", e.Cancelled, sender);
listBox1.Items.Add(s);
}
void appDeploy_UpdateProgressChanged(object sender, DeploymentProgressChangedEventArgs e)
{
string s = String.Format("UpdateProgressChanged {0}, sender: {1}", e.State, sender);
listBox1.Items.Add(s);
}
void appDeploy_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
{
string s = String.Format("CheckForUpdateCompleted {0}, sender: {1}", e.UpdateAvailable, sender);
listBox1.Items.Add(s);
}
void appDeploy_CheckForUpdateProgressChanged(object sender, DeploymentProgressChangedEventArgs e)
{
string s = String.Format("CheckForUpdateProgressChanged {0}, sender: {1}", e.State, sender);
listBox1.Items.Add(s);
}
}
Hope You got me,
please help me thnx in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
In which line does this error occur?
Roel
|
|
|
|
|
Are you sure you selected 'The application is available offline as well' on the publish tab when you published it?
Roel
|
|
|
|
|
yes i am sure, i've selected 'The application is available offline as well'
and can u please help me , how to work with Deployment.[ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;]
i couldn't create instance to ApplicationDeployment ,
please tell me whatz all the credentials needed to create an instance to ApplicationDeployment .
thnx in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
The ApplicationDeployment class does not have a constructor, so you can't create an instance of it. The only way to get an instance is to use the static CurrentDeployment property.
No offense, but I do suggest you start looking at the documentation rather than asking basic questions like this on the forum. The forum really is meant to get answers to things you can't readily figure out from the documentation.
The entire .NET framework documentation is available online. See for example:
http://msdn2.microsoft.com/en-us/library/system.deployment.application.applicationdeployment.currentdeployment.aspx[^]
Best regards,
Roel
|
|
|
|
|
|
I have to tables that I have joined together in sqlserver and I am trying to pull columns from both. However, myReader only picks up the first table's columns and i cannot retrieve any columns from the second table. How do I retrieve columns from multiple tables? Here's what I've got. Also is there just a way to type in the column names when retrieving data as opposed to specifying the column id. All suggestions welcome. thanks.
while (myReader.Read())
{
agencyname = myReader.GetString(13);
agencyaddress = myReader.GetString(4);
agencycity = myReader.GetString(26);
agencystate = myReader.GetString(15);
agencyzip = myReader.GetString(28);
agencyphone = myReader.GetString(22);
}
|
|
|
|
|
Yeah, it's possible to bring back the data by name but not the way you are doing it unfortunately. Not sure why MS do things this way but if you use:
agencyphone = myReader["YourFieldName"].ToString(); it should work (it's fine for strings but a pain for other datatypes)
I'm not sure why you only get one table's worth of fields back in the query, what does it do when run in query analyser /SQL Management Studio?
Depending on how many rows you have in each table and the width of the table it is often worth using DataRelations in a dataset to join on the client side, this can reduce the weight of data that you pull down the wire consderably.
Hope this helps,
Russell
|
|
|
|
|
Thanks Russell. By reference the columns by their names instead of their id's I was able to pull the column from the second table. You're a life save. Thanks, Again.
|
|
|
|
|
Hi,
I'm trying to get the parent of a MDI form with this code:
<br />
Coordinator c = (Coordinator) this.MdiParent;<br />
But, after the instruction, c is null (debugger);
Any tips?
Many thx,
Nuno
|
|
|
|
|
how about if you do MdiParentForm mdipf =(Mdiparentform) this.....
|
|
|
|
|
I have been working on a Windows forms application that lets you list active user sessions on a server/pc.
From there it will allow to :-
connect to a user using vnc/rdp/etc
Log off user
Shutdown PC
Restart PC
Kill remote running programs/processes
Connect to drive(s) of local machine
Connect to users home folder
List various WMI classes on the PC that user is connected to
I could list more.
But, I am trying to gauge how much interest there might be from others in helping out on an open source c# project that will utilize Windows Forms(using GridView/ListView heavily), WMI and Active directory. That will create a tool that can manage PCs/Users without the need to install local agents (although this may be added later).
I have written the code for all of the above functions already and I have lots of other functions/features to add.
It would be really great if there was any interest from someone in the community to help me develop this application further as an open source project.
So any interest/ideas?
|
|
|
|
|
This isn't really a good place to ask this question, since it's not a specific C# related programming question; maybe try under Collaboration, but I suggest either just creating a SourceForge.net project or put it up on CodePlex and go from there ...
You could always, after posting it to one of those two boards, come back and announce the project via your "CP Blog".
|
|
|
|
|
I have a class1 and in one of its methods I created a local instance of class2 passing to its ctor a member var of class1.
Within class2 I modified the parameter passed to its ctor. To my surprise when I returned to class1 its member var was also modified? C++ wouldve handled this as a local var within class2. What's going on here?
Tia.
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
you are passing a reference to the object by value, not the object itself by value. This has often been a source of confusion as it appears at first that value types and reference types behave differently. If you used a struct instead i suspect you would see the behaviour you were expecting.
It's one of those things that is very hard to explain so i'm not going to try right now as I'll probably just confuse the issue. There are a couple of articles around the place if you google for something like 'c# reference pass type by value' or similar you should find a more eloquent description of what's happening than i could provide.
HTH
Russell
|
|
|
|
|
C# passes objects by reference, but the references themselves are passed by value.
Newbies find this very confusing. I know, 'cause I did.
Cheers,
Vikram.
The cold will freeze our stares
We won't care... Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
hi all,
i have a program that make a lot of graphical drawing so it consumes a very big space of memory (i think memory leak)
Is any one know how to find where is the leak comes from
(i means where is the unreachable code)
thanx
Generator
|
|
|
|
|