|
If it helps...
OpenFileDialog and SaveFileDialog have a RestoreDirectory property... if true, it restores the chosen directory when the dialog closes. (The 'restored' directory is the InitialDirectory ).
I don't know if that is what you mean.
Matthew Butler
|
|
|
|
|
I wonder, while navigating a FileDialog on the UI thread, if the current directory changes on a background thread BEFORE the dialog closes and returns from RestoreDirectory?? Hmmm, something I'll have to test when I get some free time.
|
|
|
|
|
Hi Matthew,
Its work great to me.Now after i openfiledialog, it will restore the original path for me.Thanks
regard
cocoon
|
|
|
|
|
Hi Dave, what is your mean by "fully qualify path"?Can you please give an example?
Spanix, thanks for you reply,i will try it
Matthew, isn't if i use the restoredirectory after OpenFileDialog, the path will get back to original path?
|
|
|
|
|
Full drive and path specification:
C:\Program Files\CompanyName\AppName\SomeFolder\SomeFile.txt
|
|
|
|
|
Hi Dave,
Thanks for fast reply.I will try it (I have been solve the problem by using matthew's suggestion)
|
|
|
|
|
It's still good and future proof to use full path for the database in case next time other people use OpenFileDialog and didn't set the restore flag.
|
|
|
|
|
|
hi
i get the following error while uploading and reading an excel file THROUGH LOCALHOST.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005
if i run the program normally F5 from VSTS it works absoulutely fine. All the excel file data gets uploaded to the database.
I guess the problem occurs when the object of Excel application class is created... i tried giving permissions to ASPNET NETWORK SERVICE ADMINISTRTOR for accessing the DCOM object but still it doesnt work!
I AM USING WINDOWS VISTA as my OS.
Thanks
adi_nik
|
|
|
|
|
Hi guys
Does anyone know where we can find very accomplished Biztalk developers and architects? We have a nice opportunity for them over here....
thanks
steve
|
|
|
|
|
I've not used URI's a lot of late, but I just noticed that telling the Uri constructor:
System.Uri(string uriString, bool dontEscape)
in .NET 2.0 to not escape the string is depicted AND the function isn't even included in the framework > 2.0)
MSDN says to just use Uri(string uriString)
If you use that how the heck can you send something to "mypage.html?view=2.0" if it escapes all strings entered?
modified on Friday, April 18, 2008 2:45 PM
|
|
|
|
|
Wow, never thought I'd see something this dumb, done by the .NET team...
I found the solution:
You have to make Two URI's and use one as the base URI, so now you have two strings (for no reason), more than one line of code, and two URI objects...
example:
Uri base = new Uri("http://www.google.com/search");
Uri final = new Uri (base, "q=WTF");
Which is sooo much easier and better than:
Uri final = new Uri ("http://www.google.com/search?q=WTF", true);
WTF! why on earth would a programmer willing change it TO this?? This belongs on http://www.thedailywtf.com not in .NET
|
|
|
|
|
Hi Im having a problem with SQL and C#.
Here is a copy of my code where the problem is occurring.
private void button1_Click(object sender, EventArgs e)<br />
{<br />
oleDbConnection1.Open();<br />
oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM NASDATA where account = 'test'";<br />
oleDbDataAdapter1.UpdateCommand.ExecuteNonQuery();<br />
oleDbConnection1.Close();<br />
}
I get an exception error on the ExecuteNonQuery line.
NullReferenceException was unhandled.
Object refernece not set to an instance of an object.
On the design page i have the Oledb connector and dataadapter setup, and the test connection succeeds.
Note: I had this same problem using an Access database to.
I really hope somebody can help.
Many thanks!
|
|
|
|
|
Put a breakpoint on the ExecuteNonQuery line. When the program gets there is oleDbDataAdapter1.UpdateCommand null?
|
|
|
|
|
I apologise, i realise i put the update command instead of select.
However, i get the same problem (nullreferenceexception) if i change the code to the following:
oleDbConnection1.Open();<br />
oleDbDataAdapter1.UpdateCommand.CommandText = "UPDATE NASDATA SET EMAIL = 'TESTEMAIL' WHERE ACCOUNT = 'TEST'";<br />
oleDbDataAdapter1.UpdateCommand.ExecuteNonQuery();<br />
oleDbConnection1.Close();
It breaks on the UpdateCommand.CommandText line, saying NullReferenceException was unhandled.
Object refernece not set to an instance of an object.
|
|
|
|
|
it's the same problem. oleDbDataAdapter1.UpdateCommand is not set to a valid object (meaning that it's null) but you're trying to access its members. Add this:
oleDbDataAdapter1.UpdateCommand = new OleDbCommand();
before you try to use UpdateCommand .
|
|
|
|
|
Hi there,
how can i use application A to do something from another application?
Both applications are in C#
One application keeps track of something and when needed, needs to fire an event in the other application.
I could use arguments to start an application, but in this case the other application is already running.
Any tips or examples here?
I'm not sure as how to call it,...it's a little like client server, but,...
Hoping for some info...
Jan
|
|
|
|
|
There are number of things you can do, though "keeps track of something" is rather vague.
If it's a database you could use SQLNotification so one app will be aware changes the other app has made to the database. The same can be done with files using a FileSystemWatcher.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: There are number of things you can do
Yes there are. In this case I like the idea of putting two fingers in this guys eyes the way Moe[^] used to do. Nyak nyak nyak woop woop!
led mike
|
|
|
|
|
If the apps are running on the same machine, you can use pipes[^] or .NET remoting or WCF to communicate between the two processes.
|
|
|
|
|
You can .NET send message to the .NET handle (kind of / sort of like a pipeline), invoke (if one process spawned/grabbed the other one), and even use the use native win32 API's also...
|
|
|
|
|
Hello, i was having a problem on coding the button.. what i want to do is put the Button on the center of the form... can anybody help me please.. i used this code.. private void generateButton_Click(object sender, EventArgs e)
{
row = int.Parse(rowsBox.Text);
col = int.Parse(colBox.Text);
Button[,] landmine = new Button[row, col];
for (int _row = 0; _row < row; _row++) {
for (int _col = 0; _col < col; _col++) {
landmine[_row, _col] = new Button();
landmine[_row, _col].Width = 35;
landmine[_row, _col].Height = 35;
landmine[_row, _col].Left = 100 + _col * 35;
landmine[_row, _col].Top = 100 + _row * 35;
landmine[_row, _col].BackColor = Color.LightGray;
Controls.Add(landmine[_row, _col]);
}//end of for loop for columns...
}//end of for loop for row...
}
|
|
|
|
|
Hello,
Get the form width and height and set the button location.
Eg:
this.button1.Location = new System.Drawing.Point(form1.widht, form1.height);
Regards!
Charith
jayasshc
|
|
|
|
|
Hi,
There was a small issue with my example
use this way
this.button1.Location = new System.Drawing.Point(form1.widht/2, form1.height/2);
jayasshc
|
|
|
|
|
Try adding a panel to your form and adding the landmine controls into that panel. Then all you have to do is centre the panel controls. e.g.
<br />
private void generateButton_Click(object sender, EventArgs e)<br />
{<br />
int row = int.Parse(rowsBox.Text);<br />
int col = int.Parse(colBox.Text);<br />
<br />
Button[,] landmine = new Button[row, col];<br />
for (int _row = 0; _row < row; _row++)<br />
{<br />
for (int _col = 0; _col < col; _col++)<br />
{<br />
landmine[_row, _col] = new Button();<br />
landmine[_row, _col].Width = 35;<br />
landmine[_row, _col].Height = 35;<br />
landmine[_row, _col].Left = _col * 35;<br />
landmine[_row, _col].Top = _row * 35;<br />
landmine[_row, _col].BackColor = Color.LightGray;<br />
panel1.Controls.Add(landmine[_row, _col]);<br />
}
}
<br />
panel1.Size = new Size(row * 35, col * 35);<br />
Size parentSize = panel1.Parent.ClientSize;<br />
panel1.Location = new Point((int)(parentSize.Width / 2 - panel1.Size.Width / 2), (int)(parentSize.Height / 2 - panel1.Size.Height / 2));<br />
} <br />
You could also set the Anchor property on the panel to None to keep the controls centred while the form resizes.
"An eye for an eye only ends up making the whole world blind"
|
|
|
|