|
|
Hi there,
VERY beginners question I'm sure, but how do I find out which drive letter my program was called from?
I'm writing an autorun program for a CD which just displays a simple form with my company logo and details about the CD and what it was anti-virus scanned with. When the user presses the "okay" button I'd like to automatically run explorer.exe with the right folder open for the CD.
Can someone give me a clue?
Thanks in advance!
Gary
|
|
|
|
|
Path.GetPathRoot(Application.StartupPath) should do the job.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Application.ExecutablePath
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I want to show the chinese and janpanese character on the the windows form .
When I type any chinese or janpanese character from the arialuni.ttf font ,I get the "?' rather than acutal character.
Any help in this regard would be highly appreciated.
Thanks
|
|
|
|
|
Hi,
Dear Respected Programmers.
Kindly help me. I am using C#. whenever I try to insert a datevalue into Access database, "Datevalue Example 05/08/2006" why it inserts like this ==> "08/05/2006"
Please send me the solutions
Thank you in advance
|
|
|
|
|
Because the database interprets "05/08/2006" as the 8th of may rather than the 5th of august (or vice versa).
Use a parameterized query, then you don't have to try to match the date format with the format that the database is using.
---
b { font-weight: normal; }
|
|
|
|
|
Iam using a third party dll to connect to HP9000 database.
Iam using this in c#.net 2.0 windows forms.
It was working fine for few days but now when iam trying to connect to database
its working fine in .net 1.1 but raising the following exception in 2.0.
attempted to read or write protected memory. This is often an indication that other
memory is corrupt.
What can be the reason????????????
|
|
|
|
|
.Net 2.0 is more secure ragarding memory access violations. I assume your 3rd party component has some errors which results in accessing memory adresses it is not allowed to access.
|
|
|
|
|
OK - first of all, I am fairly certain that this is possible, but while I know .Net, I do not know C#!
I have an out-of-proc COM server that optionally accepts a "callback interface" to allow a client to receive events. This is not the same as a connection point (so-called "COM Events").
Basically, the client implements the interface and passes its pointer to the method, and the server calls methods on this interface to notify the client of something. As such, clients are both COM clients and COM servers, and can be out-of-proc (another executable) or in-proc (a middleware COM component).
Now, I am pretty sure that C# can implement COM interfaces, and that it should be able to implement one that can be used in such a way. I just want to make sure, so I can state such in my server's documentation.
So - can this kind of callback interface be utilized in C#? What are the restrictions, of any? Can the interface be coded to support calls being made back on it on different threads, perhaps simultaneously?
Adva[Thanks] nce!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I am using c# for devloping an asp.net website. The problem is that the Sqldataadapter is disabled in toolbox. I can creat it in coding but just wanted to know if I need to use SqlDataadapter from toolbox what can I do so that it becomes accesable like in windows applications???
|
|
|
|
|
Hi all,
Context:
Everyone, who is using or has used VisualStudio.Net for develoment purposes Must have seen the Properties Window that appears when you select an Object on the Form, e.g.: Button, ListBox, ComboBox, etc. The "Properties Window" shows the properties of the object that has the focus.
The "Properties Window" contains a Listbox, which has always two columns. Column1 has static values and Column2 has dynamic values. The Column2 has text boxes, ComboBoxes, Browse Buttons, etc.
Need:
I would like to have a Similar Window, that would contain a listBox, whose Column2 will contain ComboBoxes. As many ComboBoxes as there will be rows in the ListBox.
Reason:
Actually, I am mapping tables and fields of one database(lets say DB1) to tables and feilds of another database(DB2).
DB1 has static values, DB2 has runtime values, and the database could be anything and could contain any number of fields. So, I was thinking if can have somthing similar to this(Properties Window) than I may be able to load the fields on DB1 in Column1 and provide a ComboBox in Column2. Clearly, the ComboBox in Column2 will hold the fields from DB2.
Any ideas, workarounds, links, etc... will be highly appreciated.
Thanks,
ps: http://www.codeguru.com/forum/showthread.php?p=1443783#post1443783
At the above link, there is an snapshot of what I want.
|
|
|
|
|
I think the property window is a datagrid, not listview.
In datagrid you can add combobox to each cell.
Just find how to do it in CodeProject.
|
|
|
|
|
Hi all,
I have an application which has a help file stored on the server.
Every time if ther user clicks Help button on the application i have to download the helpfile from server and have to show it to user.
if the user click Help again, I have to show the opened help without downloading from server to the user. if the user closes the file and clicks Help, then i have to download the help file from server
I have tried this solution
i will download the help(same file name). if it throws exception "Process can't be accessed", then i assumes that help is already opened so i will show that to the user. if the user closes file alone not process(eg. Word file, not the word applicaton) then i am getting the error "Process exited not information available"
how can we solve this. also is there any event from Process class so that i can get know the file is being closed?
Thanks and Regards,
Srini
-- modified at 7:13 Wednesday 16th August, 2006
|
|
|
|
|
Hi,
Here's some code that fully explains how I am obviously missing something that everyone else seems to understand but me:
private decimal getBalanceOH(DateTime fDate)<br />
{<br />
MessageBox.Show("fDate passed to getBalanceOH is " + fDate);<br />
decimal BalanceOH = 0;<br />
string reportDate = fDate.ToString("MM/dd/yyyy");<br />
DataTable table = myclubDataSet.Tables["TresReports"];<br />
string expression;<br />
expression = "ReportDate = #" + reportDate + "#";<br />
DataRow[] rows = table.Select(expression);<br />
if (rows.Length == 0)<br />
{<br />
MessageBox.Show("Could not find the information sought");<br />
}<br />
else<br />
{<br />
for (int i = 0; i < rows.Length; i++)<br />
{<br />
<br />
<br />
BalanceOH = Convert.ToDecimal(myclubDataSet.Tables["TresReports"].Rows[i]["BalanceOH"]);<br />
MessageBox.Show("BalanceOH to sent to results :" + BalanceOH);<br />
DateTime repDate = Convert.ToDateTime(myclubDataSet.Tables["TresReports"].Rows[i]["ReportDate"]);<br />
<br />
if (repDate != fDate)<br />
{<br />
MessageBox.Show("I dunno what I'm doing");<br />
} <br />
<br />
return BalanceOH;<br />
}<br />
}<br />
MessageBox.Show("Error");<br />
return BalanceOH;<br />
}
It comes up "I dunno what I'm doing" all the time.
I have read that many articles and messages that it has become clear to me that I MUST be missing something.
I would greatly appreciate anyones input.
Thank you.
-- modified at 5:50 Wednesday 16th August, 2006
Glen Harvy
Very, very frustrated at the moment
|
|
|
|
|
Glen Harvy wrote: BalanceOH = Convert.ToDecimal(myclubDataSet.Tables["TresReports"].Rows[i]["BalanceOH"]);
BalanceOH = decimal.Parse(myclubDataSet.Tables["TresReports"].Rows[i]["BalanceOH"].ToString());
Glen Harvy wrote: DateTime repDate = Convert.ToDateTime(myclubDataSet.Tables["TresReports"].Rows[i]["ReportDate"]);
System.IFormatProvider FormaT = new System.Globalization.CultureInfo("sq-AL", true);<br />
DateTime repDate = DateTime.ParseExact(myclubDataSet.Tables["TresReports"].Rows[i]["ReportDate"].ToString(), "yyyy-MM-dd", FormaT );
|
|
|
|
|
I can pass any date I like - if it is a valid ReportDate then the program runs without error BUT always returns the value of Row 0 no matter what. The problem is that I can't figure out how to get the proper row to return.
Glen Harvy
|
|
|
|
|
I think the problem is here
<br />
DateTime repDate = Convert.ToDateTime(myclubDataSet.Tables["TresReports"].Rows[i]["ReportDate"]);<br />
<br />
if (repDate != fDate)<br />
{<br />
MessageBox.Show("I dunno what I'm doing");<br />
} <br />
the fDate may contains hh:mm:ss value, but the repDate is 00:00:00.
e.g
<br />
fDate = DateTime.Now;
repDate = Convert.ToDateTime("2006/08/16");
and 2006/08/16 18:14:05 != 2006/08/16 00:00:00
so you will always get "I dunno what I'm doing" all the time.
|
|
|
|
|
WuJunyin wrote: so you will always get "I dunno what I'm doing" all the time.
There's a problem with the programming logic not the date formats.
I am NOT getting the Row I am looking for returned and I don't know how to do that?
Glen Harvy
|
|
|
|
|
I'm guessing that maybe the values are the same, but the objects are not.
I'm not sure how the == operator compares the DateTimes, but it could be that the culture eg. (or something else) is different. Maybe you can print out the values of several properties and compare them.
godd luck.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
As DateTime is a value type, the == operator will be comparing the values, not the objects.
The actual values that will be compared is the value of the Ticks property. A tick is 100 nanoseconds, so the values have to be exactly the same to be equal. If they are off by 0.0000001 seconds, they are not equal.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: As DateTime is a value type, the == operator will be comparing the values, not the objects
you're probably right
Guffa wrote: The actual values that will be compared is the value of the Ticks property. A tick is 100 nanoseconds, so the values have to be exactly the same to be equal. If they are off by 0.0000001 seconds, they are not equal
this, I knew
tnx
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
A. The ReportDate is passed to the select statement.
B. The select statement supposedly retrieves all rows equalling that value.
C. The select statement returns the value contained in the ReportDate AND the BalanceOH fields.
D. Irrespective of what date I pass to the select statement, it always retieves row 0, etc AND the comparative statement is only there for cosmetic and confirmation of B. not returning the correct BalanceOH figure.
E. The value of BalanceOH is not the balance corresponding to the date I want.
F. The comparison is only made to confirm to me that I don't know what I'm doing.
If there was a problem with the formatting of the dates, then I don't see why the select statement is retrieving any rows at all.
What I think is wrong is that I am always going to get the value 0 returned becuase that is what the value of i is. Shouldn't I be passing the value of the row number corresponding to the selected ReportDate of the datatable?
BalanceOH = Convert.ToDecimal(myclubDataSet.Tables["TresReports"].Rows[i]["BalanceOH"]);
Glen Harvy
|
|
|
|
|
Glen Harvy wrote: If there was a problem with the formatting of the dates, then I don't see why the select statement is retrieving any rows at all.
Actually I'm not talking about the formatting.
What I thought was that the culture retrieved from the database was eg. EN-us while the culture you are working with was Neutral. Furthermore, according to Guffa, the "==" operator should only check the values. In that case I was wrong.
How many rows do you retrieve? Isn't there a possibility to step into the code?
Also, as mentioned above by Guffa, one thick difference is a difference.
You could check eg. on year, month, and day instead of the entire DateTime object.
The problem probably lies in a very small corner.
Glen Harvy wrote: What I think is wrong is that I am always going to get the value 0 returned becuase that is what the value of i is. Shouldn't I be passing the value of the row number corresponding to the selected ReportDate of the datatable?
BalanceOH = Convert.ToDecimal(myclubDataSet.Tables["TresReports"].Rows[i]["BalanceOH"]);
I'm not sure what you mean by this, but a DataSet is just like a the view you get when executing a select statement. What you can do is execute the select statement in the database itself. That view should exactly be the contents of your DataSet. If you iterate through it with a for loop you should get each row of that view.
Good luck.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
If any body call URLDownloadToFile using c#.net in web application,
what are the parameters that i shall pass.
Bibhu
|
|
|
|