|
Thanks , your answer was helpful .
Sorry for my English. I'm a freshman .
|
|
|
|
|
hi
i have a dataGridView and some textBox for each field, i want when i user double click on dataGridView, my controls bind to datasource that my dataGridView bound to, hitherto, it worked correctly and all row information display in appropirate textBox, this is edit mode, i want in this state, user can't change row until click ok or cancel info, but how to prevent row changing in datagridView ?
thanks
|
|
|
|
|
How do i dispaly the files and folders of a site in a tree view or simular format to windows explorer
Thanks
|
|
|
|
|
With a tree view control.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
In grid view Control,How can i represent a check box which is embed in the grid view.
|
|
|
|
|
I am close to certain there's a code project article on how to do this.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Hello everyone,
I am using the following code segment to check the status of a specific Windows service. My question is, if the service name does not exists, when we tries to get the Status property of the Windows service, there is InvalidOperationException. What is the elegant way to solve this issue (I have not found an API to check whether a service exists, and if I can check whether a service exists, I can check the Status property only for the service which exists)?
ServiceController controller = new ServiceController("not existing service");
try
{
if (controller.Status == ServiceControllerStatus.Running)
{
}
}
catch (InvalidOperationException ex)
{
}
}
thanks in advance,
George
|
|
|
|
|
You could use the ServiceController.GetServices() method to enumerate through all services and check if there is a service with a name that you're interested in. Or you could use WMI.
|
|
|
|
|
Thanks Zoltan!
Your solution works!
regards,
George
|
|
|
|
|
Hello everyone,
My application can be started as both console mode from main function and servide mode from OnStart.
My question is, is there any elegant way to detect whether the application is run under console mode or servide mode? Currently, I set a status in main function manually to detect whether it is run under console mode or service mode.
Any more elegent solution or built-in API I could use?
thanks in advance,
George
|
|
|
|
|
I use:
if ( System.Environment.UserInteractive )
{
}
else
{
}
|
|
|
|
|
Thanks PIEBALDconsult,
Great! I have tested that in console mode, the value is true and in Windows servide mode, the value is false.
Looks like even if my application does not have an user interface, like Windows Form, and my application is a pure console application, the property value is still true.
So the user interactive does not mean GUI?
regards,
George
|
|
|
|
|
I have a form with a DataGridView on it. I have an event handler for the MouseUp event. I am trying to make a context menu popup on a right mouse click only, and appear right under the mouse.
Here is what I have so far:
private void PlayList_CellClick(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
Point loc = this.PointToScreen(new Point(e.X, e.Y));
int index = PlayList.HitTest(e.X, e.Y).RowIndex;
PlayListMenu.Show(loc.X, loc.Y);
}
}
It almost works, the context menu just doesn't popup in the right place. Any ideas?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I got it to work like this:
private void PlayList_CellClick(object sender, DataGridViewCellMouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
Point loc = new Point(e.X, e.Y + PlayList.ColumnHeadersHeight + (PlayList.Rows[0].Height * e.RowIndex));
PlayListMenu.Show(PlayList, loc);
}
}
Is there a better way? Know of the right way?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
You have achieved what you wanted to do for now. The function Control.PointToScreen() and the corresponding counterpart will be helpful at other times.
|
|
|
|
|
I have created my own ribbon in Excel and placed a button inside it. How can i invoke say another tab (home tab) using my button? In C++, we are supposed to get the handle of the application first and then call its methods. I do not know how to do it in C# code. Any help will be appreciated.
|
|
|
|
|
post the message in the c++ board
|
|
|
|
|
|
i want 2 BinaryWriter for a file, is it possible ? i tried with this code, but everytime it gave error that file is being use by other process, here is code :
BinaryWriter bw = new BinaryWriter(new FileStream(textbox1.Text, FileMode.Create,FileAccess.Write,FileShare.Write));
BinaryWriter bw1 = new BinaryWriter(new FileStream(textbox1.Text, FileMode.Open));
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Simple, they both need to have FileShare set:
BinaryWriter bw = new BinaryWriter(new FileStream(textbox1.Text, FileMode.Create,FileAccess.Write,FileShare.Write));
BinaryWriter bw1 = new BinaryWriter(new FileStream(textbox1.Text, FileMode.Open, FileAccess.Write, FileShare.Write));
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
ohh...i thought just 1 need to share, thanks
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi Guys. I have just spent about 5 hours searching the web trying to find a solution to my problem. I am busy with a project where I am writing data to an Excel file. This works fine. I then want to save the Excel file to a pre-selected directory which the user select using the folderBrowserDialog. Now, I need to know how do I then save my file to the directry selected. I am displaying the Selected path in a txtbox. I only want to save the file to this directory.
follderBrowserDialog code:
private void btSelectDirToSave_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
txtboxSelectExcelDir.Text = folderBrowserDialog1.SelectedPath;
}
}
File save code:
string namefile;
namefile = txtboxSelectExcelDir.Text;
objExcel.ActiveWorkbook.SaveAs(namefile + "_Nom022.xls",Excel.XlFileFormat.xlWorkbookNormal,Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
Any Help would be greatly appreciated as the file is currently not being saved to the selected directory but the Directory name is appended to the filename and saved somewhere else.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
use this method i find it easier
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { txtboxSelectExcelDir.Text = folderBrowserDialog1.FileName; }
String info = String.Empty;
using (StreamWriter sw = File.CreateText(folderBrowserDialog1.FileName)
{
sw.Write(
Make sure the info is seperated by tabs, to indicate different cells
for example,
col1, row1\tcol2, row1\r\ncol1, row2\tcol2, row2
|
|
|
|
|
This means that I would have to change my whole code process. I just need to know how to pass the Directory path to the save function. CHanging the coding I have done is not much of an option.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|