|
I have an outlook bar with a bunch of buttons. When you click one of the buttons, it will open a certain program. The only problem that I have is that it opens the program about 20 times. Any ideas?
Here is the code for opening the program:
<br />
private void clickAction(object sender, System.EventArgs e)<br />
{<br />
Process.Start(@"....");<br />
}<br />
Thanks.
By BigBlob202
Dinco Inc.
|
|
|
|
|
Yeah, don't click it after a second time. If you need only one instance of these programs, then write them accordingly. There are several articles here on CodeProject on how to write single instance applications. You could easily adapt this to make your application stick with a single application instance if the application is beyond your control. Mutexes make this easy.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how to get Serial Number of a flash memory pluged into the USB port?
or any information about the pluged device into the USB port?
|
|
|
|
|
|
I have a brokerage account that provides streaming real-time stock quotes via an internet applet and I'd like to import the data into a C# application for further manipulation. Two ideas that occurred to me are
1)Screen scraping the data from the applet window on my desktop, and
2)Intercepting the TCP data stream as it comes across port 80.
Unfortunately, I haven't done much work with Windows API and can't figure out how to implement either one. Any thoughts or suggestions?
|
|
|
|
|
|
hi im wondering how do i take a selection from a list and store it in a database...do i have to
1. make the selection
2. take the selection and store it into a string
3. store the string into the database
or
1. make the selection
2. store it into the database by doing this
"INSERT INTO Pharmacy ListboxColumn Values '"+listbox.selecteditem+"'";
also how do i take multiple selection and store it in a string?
txh in advance
|
|
|
|
|
ASGill wrote:
store the string into the database
Look and search for SqlCommand ,SqlDataAdapter in MSDN and this site for sample.
ASGill wrote:
. take the selection and store it into a string
Look for ListBox.SelectedValue in MSDN
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
got it working mazdak!....thx alot for ur directions..
anyways, im kinda curious here.... when i've completed my app and i'd have to present it in a networked environment..what do i need for my app to run on a completely different machine...like Java's got their Virtual Machine (JVM) and such..also pls tell me the list of OS's thats compatible with a .Net app. i know i can get all this info from the internet...i just wanna doubl confirm..so that im not doin anything wrong..
also...im trying to implement a splash screen, how do i start my app with splash screen first...
i tried
[STAThread]
{
Application.Run(new frmSplash);
}
but then the splash screen does not wanna close at all...how do i go about this.
oh yeah and another thing...can i have your name...i'd like to add it in my acknowledgement and also referrence.
thx in advance
Arvinder Gill
|
|
|
|
|
For your first question you need to install .NET framework on each machine you want to run your application. Also if you use ADO.NET (which you used) you need to install latest version of MDAC on that machine, specially if that OS is not WinXP.
About spalsh screen, I haven't done it myself in C# but if you want to put it before Application.Run() you have to close before it too cause that line actualy doesn't finish until you close your application. You can first show splash, then use sleep function for wait some seconds,then close it. Same thing can be done in Load event too, but I don't know best solution until I test it myself.
ASGill wrote:
can i have your name...
Well, you already know it. My name is Mazdak.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
hi mazdak
sorry maz...im a lil bit blur here right now...what's MDAC??...
CODER
|
|
|
|
|
|
As the title says, I am wondering about how to get and set scrollbar positions of a rich textbox control.
I want to make haxa editor using C#. so I used 3 richbox. first richbox displays the line number, second richbox displays Haxa data and the last richbox display ascii code. so all richbox scrolled at same position and at the same time.
Does anyone know a method to get and set textbox scrollbar positions?
|
|
|
|
|
neoksd wrote:
Does anyone know a method to get and set textbox scrollbar positions?
Off the top of my head you can P/Invoke GetScrollPos and SetScrollPos . I think you might be better to P/Invoke GetScrollInfo and SetScrollInfo instead though.
- Nick Parker My Blog
|
|
|
|
|
Hi,
I want to create a GUID for a file
the problem is that
case 1
i want to keep track of the file even if its name .creation date are changed
case 2
i cannot use the file name , file size and file type because two diffrent files can have the same name ,same size and same type
Requirement
i want to check that if any other person has that file with a different name but same contents
i should be able to recognize that it is the same file
Can you please help me out that what parameter should bee use to create the guid and over come the probem
Example
file name Size content(written in file)
abc.txt 1 abc
abc.txt 1 bac
How can i make differnt GUID for these files and same for below mention
file name Size content(written in file)
abc.txt 1 abc
bac.txt 1 abc
|
|
|
|
|
MD5 checksums would be you best bet, maybe even going as far as looking how file hashes are performed in emule.
top secret
|
|
|
|
|
You can easily create a new GUID, they will always be different from one another.
Guid g = Guid.NewGuid();
- Nick Parker My Blog
|
|
|
|
|
You could create a new GUID easily in .NET. But how are you going to attach that GUID to the file? You can't put it in the file because then you would have two files with the same GUID. It sounds like your trying to attach a serial number to a file and then letting the user manipulate the file any way they want, even moving and renaming, and keep track of the file and its copies. A daunting task, indeed. You'll need to write an entire extension package to NTFS to get this to work.
RageInTheMachine9532
|
|
|
|
|
No you don't. You merely attach an alternative data stream[^] to the file, something NTFS already supports. You could also use the \005SummaryInformation ADS which NTFS also provides - the same one that appears by default on all files on an NTFS volume.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Whoops! My bad! I forgot about alternate streams. I haven't used them at all , but have read about the concepts on MSDN somewhere about 5 years ago.
RageInTheMachine9532
|
|
|
|
|
Hi,
I think i'm going mad .....
All i need to do is convert a DOS style 8.3 file name to the full expanded format name ... but i'm damned if i can find a way to do it.
I think i can do anything to a file apart from this.... please help ... preserve my sanity.
Thanks ... Andy
|
|
|
|
|
If the .NET Framework doesn't support this you can P/Invoke either GetLongPathName or GetFullPathName .
- Nick Parker My Blog
|
|
|
|
|
Thanks Nick...
Just for anyones interest the code looks something like ....
Declare the routine like this ...
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern long GetLongPathName(StringBuilder ShortFileName, StringBuilder LongFileName, int Length);
StringBuilder shortName = new StringBuilder(filename);
StringBuilder longName = new StringBuilder(512);
long bufLength = longName.Capacity;
long retCode = GetLongPathName(shortName, longName, bufLength);
|
|
|
|
|
Hi...im trying to do password checking for multiple users...
the problem is that i get a runtime error saying the specified cast is invalid(line 272) ...i've check that im getting a string...so what could the problem be
<br />
private void btnOK_Click(object sender, System.EventArgs e)<br />
{<br />
dataSetPWD.Clear(); <br />
<br />
if(txtPassword.Text.Length > 10 && txtPassword.Text != "")<br />
{<br />
MessageBox.Show("The password textbox should contain more than 1 character and less than 10 characters. Please check your password.","Information");<br />
<br />
}<br />
else<br />
{<br />
try<br />
{<br />
oleDbConnection1.Open();<br />
<br />
oleDbDataAdapter1.SelectCommand.CommandText = "SELECT UserType FROM Password WHERE UserName = '"+txtUsername.Text+"' AND Password = '"+txtPassword.Text+"'";<br />
<br />
<br />
oleDbDataAdapter1.Fill(dataSetPWD);<br />
<br />
System.Data.DataTable Password = dataSetPWD.Tables[0];<br />
<br />
if(Password.Rows.Count != 0)<br />
{ <br />
<br />
string s = (string) Password.Rows[0][0]; --> LINE 272<br />
s.Trim();<br />
s.ToString();<br />
<br />
<br />
if(s.Equals("reception"))<br />
{<br />
frmReception rm = new frmReception();<br />
rm.Show();<br />
}<br />
else if(s.Equals("doctor"))<br />
{<br />
frmDiagnosis dm = new frmDiagnosis();<br />
dm.Show();<br />
}<br />
else if(s.Equals("pharmacy"))<br />
{<br />
frmPharMenu pm = new frmPharMenu();<br />
pm.Show();<br />
}<br />
<br />
else <br />
{<br />
MessageBox.Show("Invalid Password or User Name. Please check your user name and password. It is case sensitive","Invalid Entry");<br />
<br />
}<br />
}<br />
else<br />
{<br />
MessageBox.Show("No Such Record");<br />
}<br />
}<br />
catch (Exception ErrorPassword)<br />
{<br />
MessageBox.Show(ErrorPassword.ToString(),"Password Error");<br />
}<br />
finally<br />
{<br />
oleDbConnection1.Close();<br />
oleDbConnection1.Dispose();<br />
}<br />
}<br />
<br />
}<br />
CODER
|
|
|
|
|
You could use .ToString() instead of (string) to see what you actually get.
Could it be that Column[0] isn't the user type you expect? I think it would be more robust and easier to read if you used Password.Rows["UserType"][0] (or whatever your column's name is)...
BTW, the first if clause is wrong . It won't get passwords that are too short. You should change && for ||.
Regards,
mav
|
|
|
|