|
Hello everybody,
I had an mdi from having an toolStrip on the click event of toolstrip button i want to close all the opened child form but i am unable to do so.
Regards,
rahul saini
|
|
|
|
|
Have you tried calling Close() on all forms in your Mdi Form's MdiChildren ?
Standards are great! Everybody should have one!
|
|
|
|
|
hi,
I've tried the following code at http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic6944.aspx
i've made the changes they say, but it still doesn't work when i insert a usb device (flashdisk).
I'm trying do detect when a device is inserted into a usb port. how can i do it? and if possible, which port it was inserted at. it's for a WPF app
EDIT: ok, it's working now, but i have the same questions that the person with the code posted:
1)Check if the device is inserted or removed..How do i do that??
2)also i want to check Total storage (capacity)of the device connected
c) storage(unused)available in the device
thanks donovan
-- modified at 6:54 Thursday 12th July, 2007
rather have something you don't need, than need something you don't have
|
|
|
|
|
Maybe this can help you http://www.codeproject.com/cs/system/DriveDetector.asp ?
As for storage Use GetDrives() function to get all drives and identify the drive you are interested in. Then you can use DriveInfo functions to get necessary information
|
|
|
|
|
Hello,
I'm using System.Management functionality for that!
WqlEventQuery q_creation = new WqlEventQuery();
q_creation.EventClassName = "__InstanceCreationEvent";
q_creation.WithinInterval = new TimeSpan(0,0,2);
q_creation.Condition = @"TargetInstance ISA 'Win32_DiskDriveToDiskPartition'";
mwe_creation = new ManagementEventWatcher(q_creation);
mwe_creation.EventArrived += new EventArrivedEventHandler(USBEventArrived_Creation);
mwe_creation.Start();
internal void USBEventArrived_Creation(object sender, EventArrivedEventArgs e)
{
}
WqlEventQuery q_deletion = new WqlEventQuery();
q_deletion.EventClassName = "__InstanceDeletionEvent";
q_deletion.WithinInterval = new TimeSpan(0,0,2);
q_deletion.Condition = @"TargetInstance ISA 'Win32_DiskDriveToDiskPartition' ";
mwe_deletion = new ManagementEventWatcher(q_deletion);
mwe_deletion.EventArrived += new EventArrivedEventHandler(USBEventArrived_Deletion);
mwe_deletion.Start();
internal void USBEventArrived_Deletion(object sender, EventArrivedEventArgs e)
{
}
For checking the free and available space:
public void Hashtable GetFreeDriveSpace()
{
Hashtable drivefreespace = new Hashtable();
ManagementClass mcDriveClass = new ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection mocDrives = mcDriveClass.GetInstances();
foreach(ManagementObject moDrive in mocDrives)
{
try
{
String sDeviceId = moDrive.Properties["DeviceId"].Value.ToString();
double dSize = double.Parse(moDrive.Properties["Size"].Value.ToString());
double dFree = double.Parse(moDrive.Properties["FreeSpace"].Value.ToString());
}
catch
{
}
}
mocDrives.Dispose();
mcDriveClass.Dispose();
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
thanks to both of you, seems both solutions would be able to solve my problem!
thanks again
donovan
rather have something you don't need, than need something you don't have
|
|
|
|
|
Hi frinds,
My Question is simple. How to convert the CSV file to XLS file using the C# Programming langueage.
Thanks,
Liyakhat.
|
|
|
|
|
You can use the Excel Application object Microsoft.Office.Interop.Excel namespace...
|
|
|
|
|
Hi Bijesh,
First of all thanks, I got the code to Convert CSV file to XLS file using Excel Application object.
My code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using Microsoft.Office.Interop.Excel;
namespace File_Conversion
{
class Program
{
static void Main(string[] args)
{
ApplicationClass app = new ApplicationClass();
Workbook doc = app.Workbooks._Open(
@"C:\GCProject\Input Example.csv",
Missing.Value,
Missing.Value,
Missing.Value,
Missing.Value,
Missing.Value,
Missing.Value,
Missing.Value,
Missing.Value,
false,
Missing.Value,
Missing.Value,
false);
Console.WriteLine("Reading CSV File........");
doc.SaveAs(
@"C:\GCProject\Output.xls",
XlFileFormat.xlWorkbookNormal,
Missing.Value,
Missing.Value,
Missing.Value,
Missing.Value,
XlSaveAsAccessMode.xlExclusive,
Missing.Value,
false,
Missing.Value,
Missing.Value,
Missing.Value);
doc.Saved = true;
Console.WriteLine("Converted CSV to XLS file");
app.Quit();
Console.ReadLine();
}
}
}
But Now, I have to get specified format, Like.
My CSV file Contains Data like.
-----------------------------------
Ex: DriverID | CustomerID | Ship to ID | Load # | BOL Date/TimeStamp |PrdNam
520 | 2355 - | 1 | 61953 | ############ | 1 Eth 87
My XLS file Contains Data Like.
-----------------------------------------------------------------------------
Ex: Field | Definition | Length | Starting Column | Ending Column |
-----------------------------------------------------------------------------
delimiter"
-----------------------------------------------------------------------------
TransType|Some Definition |1 | 1 | 1
|
-----------------------------------------------------------------------------
delimiter ","
-----------------------------------------------------------------------------
Termin ID | Some Difinition| 3 | 3 | 5
|
-----------------------------------------------------------------------------
delimiter ","
-----------------------------------------------------------------------------
Term SPLC | Some Difi | 7 | 6 | 12
|
-----------------------------------------------------------------------------
I got the code converting CSV file to XLS file. But What I need is Converted
XLS file should look like above format in Converted Excel sheet.
Hope I explained well.!
Thanks in advance.
Regards,
Liyakhat.
|
|
|
|
|
try using Google[^] - the first result gives you a full code example of the answer to your problem
|
|
|
|
|
|
Christian answered this question for you when you asked it yesterday and Jamie answered it the day before. Please don't repost questions.
You need to understand that people here will normally give you the hints/areas that you need to look at in order to complete your task. They will not give you the complete application. You are expected to do some work on your own, and having been told to look at office Interop it is not unreasonable to think that you will have used <<insert search="" engine="" of="" choice="" here="">> to research the topic. If you have a problem with code then tell us what you have done, where the problems are and what they are. At that stage, we will be able to provide more help.
|
|
|
|
|
Hi,
I have tried to write a cookie then read it. If it return true, meaning that the user's cookies is enabled and if it return false, that mean the cookies has been disabled. Unfortunately, when I turn my cookies off using IE, I was clueless when it always return me true. I have tested the same project with Firefox, it works pretty well!
Please help~
below is a part of my code in C#:
HttpCookie c;
if (!Page.IsPostBack)
{
if (HttpContext.Current.Request.Cookies["TestCookie"] != null)
{
c = Request.Cookies["TestCookie"];
c.Expires = DateTime.Today.AddDays(1);
c.Values.Add("testing","testing");
}
else
{
c = new HttpCookie("TestCookie");
c.Expires = DateTime.Today.AddDays(1);
c.Values.Add("testing","testing");
}
Response.Cookies.Add(c);
c = null;
}
if (Page.IsPostBack)
{
if (HttpContext.Current.Request.Cookies["TestCookie"] != null)
{
c = Request.Cookies["TestCookie"];
Response.Write("Cookie Enable");
}
else
{
Response.Write("Cookie Disable");
}
}
|
|
|
|
|
For me it is working fine
sharath Chandra
|
|
|
|
|
I want a RowHeaderCell displaying a Value only and no glyphs whatsoever.
The problem i'm facing is the Selection glyph and the space the icons seem to claim.
Is there a DisableAllGlyphsAndReclaimSpace-property available I haven't discovered yet?
I also noticed a bunch of Non-Public members:
DATAGRIDVIEWROWHEADERCELL_contentMarginHeight up to DATAGRIDVIEWROWHEADERCELL_verticalTextMargin
I think they also have something to do with it.
|
|
|
|
|
Hello,
i have 2 problems
i've created a .Net hosted control library which should run with explorer, and it loads when i'm starting html page
but when it tries to work with files, Runtime throws an exception
1) Could you write how-to configure my DLL in .Net framework mmc
(it shows messages that strong name required and so on)
2) I have a public available
event OnCompile(string text)
and a public available variable
oncompile
but when i'm trying to add an event handler to my .Net control in Java script
like
document.supercontrol.oncompile = javascriptproc
function javascriptproc(text)
{
document.write(text);
}
it doesn't work
Thank's
|
|
|
|
|
Hi all,
depending on an access level of my app's I want to suppress a statechange of a radiobutton field (without disabling the controls). On a checkbox control I can override the onclick event and use the BeforeStateChange event.
A radiobutton doesn't have such an event.
Who has an idea to do that ?
tnx Frank
fracalifa
|
|
|
|
|
Hello,
You could still override OnClick, and use MouseDown as for the functionality of BeforeStateChange.
Or fire your own event in the OnClick Method.
All the best,
Martin
|
|
|
|
|
Hi,
dont know about BeforeStateChange event, it is not in my MSDN documentation.
Same MSDN documentation says one should not use RadioButton.OnClick
for RadioButtons you can set AutoCheck=false and do all the Checked logic
yourself.
I consider it bad practice to change the behavior of a standard Control:
a RadioButton (group) should either be enabled and you can operate it normally,
or disabled and you cant operate it at all. For me there is no way in between.
|
|
|
|
|
Hello Luc,
Luc Pattyn wrote: I consider it bad practice to change the behavior of a standard Control
I don't agree in this point, as I often manipulat standard Controls for my needs.
As "overriding" gives me the chance to change the behavior of controls in the way my "customer" is used to it from machines my company delivered years ago.
And I think the point is, as some people (including me) are not doing WEB Applications or standard Windows Application for PC's, your statement doesn't fit for all.
All the best,
Martin
|
|
|
|
|
Hi Luc,
you are right, sorry, I override the onclick event and created an own event called checkBeforeChange like this
protected override void OnClick(EventArgs e) <br />
{ <br />
if(this.BeforeStateChange != null)<br />
{<br />
this.BeforeStateChange(this, ref cancelStateChg);<br />
}<br />
if(this.cancelStateChg)<br />
{ <br />
this.Checked = !this.Checked;<br />
} <br />
base.OnClick (e);<br />
}<br />
this code is working on a checkbox, but not on a radiobutton.
I would use enable=true/false but the bad is the color change to gray. If I could prevent the colorchange, everything would be fine.
Frank
-- modified at 6:37 Thursday 12th July, 2007
|
|
|
|
|
I understand that, but the basic point is a Control that is disabled MUST
look different; if it did not, the user would manipulate it unknowingly,
and then complain it does not work as expected.
|
|
|
|
|
Hi luc
a disabled control should look different, but in a way I can decide of, and not in the way MS do.
tnx
|
|
|
|
|
Standards are fantastic. Everyone should have one.
|
|
|
|
|
A simple solution is to intercept checkchanged, and set the button back to checked if it is not checked.
Not the most elegant though
|
|
|
|