|
I didn't think so. I have recollections of writing code to do what I suggested, out of necessity
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
We use
File.WriteAllBytes("//full path",byteArray)
to write file on the drive of the system we are working.
But if we want that instead of writing on the same system, it writes on other system on the LAN while we have the privileges to write it then what should be given as parameters in this method or is their any other class that support this?
|
|
|
|
|
Can you map a network drive to that directory and write it that way?
|
|
|
|
|
No .... without maping the network drive ....is it possible? if it is then how??
|
|
|
|
|
Well, you should be able to write to a UNC path, but it would have a lot to do with permissions. Your application may be running under a different identity or a lower trust level than is required. For instance, I can successfully run this code on my network:
static void Main(string[] args) {
FileInfo fi = new FileInfo(@"\\othermachine\C$\IAmATest.txt");
using (StreamWriter sw = new StreamWriter(fi.OpenWrite())) {
sw.WriteLine("Hello World!");
}
fi.Delete();
}
There's nothing special required to write to this particular path. I have this inside a command line app and I'm running on a domain account, so I know that I have access to write to that path. If you're running under an NT service or IIS, you may want to impersonate a different user account.
|
|
|
|
|
Hi All,
I want to add seperator on toolbar. I am using the following code to add button.
HelpButton = (CommandBarButton)oStandardBar.Controls.Add(1, missing, missing, missing, missing);
//firstButton.Style = MsoButtonStyle.msoButtonCaption;
HelpButton.TooltipText = "Help";
HelpButton.Tag = "btnHelp";
HelpButton.Click += new _CommandBarButtonEvents_ClickEventHandler(ButtonClick);
AddImage(ref HelpButton, "Help");
Please suggest how I can add seperator between two buttons on toolbar.
Thanks in advance.
asd
|
|
|
|
|
Hi,
Add a new button to your toolbar. Change its name to <anythingyoulike> , ( eg. tbbSeparator1 ) and change its Style to Separator.
When you change the Style property of the button to Separator, it disappears from the toolbar, or at least it seems to. When a button is designated as a separator, it's simply an empty placeholder used to create a space between two buttons. Because this separator is at the end row of buttons, you can't see it.
Move it to the second position by selecting it in the ToolBarButton Collection Editor and clicking the up arrow that appears to the right of the Members list; this arrow and the one below it are used to move a button up or down in the list. Click OK to save your changes and your toolbar will now have a space between the two buttons.
Have fun!
Regards,
|
|
|
|
|
Thanks for the reply.
But I am creating the add inn application and creating the command bar through the code (C#).
For button style i am using
customButton.Style = MsoButtonStyle.msoButtonIconAndCaption;
and no seperator kind of style available for MsoButtonStyle
Thanks.
asd
|
|
|
|
|
Use customButton.BeginGroup = true; for the second button.
|
|
|
|
|
An easy way of seeing how to do things like this is to create a dummy-project, set it up as you like to have it by using the graphical editor, and then look at the code.
Internet - the worlds biggest dictionary
|
|
|
|
|
I want to check a submenu, but i dont want this menu closes after that.
¿how can i do this?
nada
modified on Monday, September 12, 2011 11:58 AM
|
|
|
|
|
I think you have to be a bit more specific. What kind of submenu , how do you call it.
Cheers,
|
|
|
|
|
Hello,
I am having on delegate declared in a dll as
public delegate Object InvokeMethod(ResponseHandler responseHandler, Object[] arguments);
initialized in constructor
public ResponseProxy(InvokeMethod invokeMethod, ResponseHandler responseHandler)
{
responseHandler_ = responseHandler;
invokeMethod_ = invokeMethod;
}
Now i want to call ResponseProxy from my C# class and my problem is that how to pass first param "invokeMethod".
If i am calling it from Form class then i can do this.Invoke and working fine like
ResponseProxy(this.Invoke, EnumToolsHandler, "EnumToolsHandler")
but what if i am calling it from any .cs class. It requires InvokeMethod and if i create a object of it how should i initialize it
Please tell me how can i sort it out.
Thanks in advance.
Gajesh
Pune(India)
|
|
|
|
|
Hi all:
I have a form which more than one hundred TextBoxes on it,if one of the TextBoxes is changed(for instance,change the Text of the Box),how can I know that change?
Nothend
|
|
|
|
|
Hi
Just share the same event for all the 100 TextBoxes. For example if you know the Text changed TextBox Name,
private void textBox_TextChanged(object sender, EventArgs e)
{
TextBox txt = (TextBox)sender;
MessageBox.Show("The Current TextBox is " + txt.Name);
}
All the TextBox's TextChanged events will share the above event.
Cheers,
Chandru.
|
|
|
|
|
Thanks.
but I'm sorry, as you said ,I will write 100 enents of XXX_TextChanged ?
What I care is the change,if any of the TextBoxes is changed,I will set a boolean variable false.So how to achieve that?Thanks!
Nothend
|
|
|
|
|
Write one forAll_TextChanged and add it to all textboxes. Can be done "manually":
textBoXX.TextChanged += new System.EventHandler(forAll_TextChanged)
or by selecting it in the TextChanged-dropdown for each text box in event-tab in VS (2005 at least).
Note that you have to have the proper format of the forAll_TextChanged method.
Internet - the worlds biggest dictionary
|
|
|
|
|
Thanks a lot ,it works!!!
Nothend
|
|
|
|
|
use the TextChanged event of the textbox
|
|
|
|
|
Hi I’m working on a system that has 4 different types of client they have mostly the same attributes so I decided to create an interface IClient for them to implement and then just add the differing attributes as needed to each client class.
Now I get the Client information from a DB and Load them into a Generic dictionary
The class looks like so
[code]
class Class1<T> : Dictionary<int, T> where T:IClient
{
private IndemnityScheme scheme;
public Class1(IndemnityScheme scheme)
{
this.scheme = scheme;
}
public int Load()
{
// "procIndemnityClientSelect";
DataBaseAccess dba = new DataBaseAccess(this.scheme);
SqlDataReader reader = dba.LoadData("procPrsymClientSelect");
SmartDataReader smartReader = new SmartDataReader(reader);
while (smartReader.Read()) {
AceClient newClient = new AceClient(this.scheme);
newClient.Clientshort = smartReader.GetString("Client Short Name");
newClient.Clientname = smartReader.GetString("Client Name");
newClient.Clientref = smartReader.GetInt32("client ref");
newClient.AddressLine1 = smartReader.GetString("Address Line 1");
newClient.AddressLine2 = smartReader.GetString("Address Line 2");
newClient.AddressLine3 = smartReader.GetString("Address Line 3");
newClient.AddressLine4 = smartReader.GetString("Address Line 4");
newClient.AddressLine5 = smartReader.GetString("Address Line 5");
newClient.AddressLine6 = smartReader.GetString("Address Line 6");
newClient.Telephone = smartReader.GetString("Telephone No");
newClient.PostCode = smartReader.GetString("post code");
newClient.Contact = smartReader.GetString("Contact");
// newClient.Handler = smartReader.GetString("Handler");
newClient.Joindate = smartReader.GetString("Join Date");
newClient.Leavingdate = smartReader.GetString("leaving Date");
newClient.Salutation = smartReader.GetString("salutation");
newClient.Email = smartReader.GetString("Email");
newClient.Comments = smartReader.GetString("comments");
base.Add(newClient.Clientref, newClient);
}
smartReader.Close();
smartReader = null;
dba = null;
return base.Count;
}
}
[/code]
I call the class in my program like so
[code]
AceClient c = new AceClient(IndemnityScheme.ACE);
Class1<AceClient> cl = new Class1<AceClient>(IndemnityScheme.ACE);
cl.Load();
foreach (AceClient ac in cl.Values) {
System.Diagnostics.Debug.WriteLine(ac.Clientshort);
}
[/code]
Nothing fancy just want to loop throught the collection but on trying to complie I get an error.
This is the line of code that errors
[code]
base.Add(newClient.Clientref, newClient);
[/code]
Error 24 The best overloaded method match for 'System.Collections.Generic.Dictionary<int,T>.Add(int, T)' has some invalid arguments
Error 25 Argument '2': cannot convert from 'Prsym.AceClient' to 'T'
Can anyone tell me what I am doing wrong??
|
|
|
|
|
Does AceClient implement the IClient interface? This error can occur because the class violates the conditions of the generic (in this case where T implements IClient).
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks for the reply yes the AceCLient does Implement ICleint.
I was hoping that
class Class1<t> : Dictionary<int,t> where T:IClient
would mean the Dictionary Type would be of the Type of the instantiate calls so in my instanace the dictionary would be Dictionary<int, aceclient).
this="" does="" not="" seem="" to="" be="" happen="" i="" have="" been="" able="" work="" around="" this="" by=""
="" class="" class1<t=""> : Dictionary<int,iclient> where T:IClient
It just means if i wish to access the collection by a class that implements ICLient i have to do the following casting
((AceClient)col[1]).Temp;
where col is the collection and Temp is and exdened property of AceCLient Not found in IClient
|
|
|
|
|
I begin learn C# i create 2 class connect.cs and Dataacess.cs
in Dataacess class I want to using connect class like VB.net Imports a class but error
using Connect;
i don't understand
Tell me about please
Thanks
quan
|
|
|
|
|
using is for namespaces. If your classes have the same namespaes, you don't need it. In fact, imports works the same way.
Connect c = new Connect();
will create an instance of the connect class for you.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi,
I have create a custom user control.How can i create the control dynamicly and put into a array.
any hits are welcome,
thanks in advance
cocoonwls
|
|
|
|