|
Hmmm the documentation for String isn't that difficult to follow!
Try String.IndexOf(String)
|
|
|
|
|
How can export specific record(s) in MS Access mdb file to text comma seperated file?
Jassim
|
|
|
|
|
I would look at pulling the stuff into a DataSet and then exporting it as XML instead of csv files. Why do you need it as a text file?
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
ok but can you tell me about the following :
1. can I have a sample code please?
2. Can I protect the XML file with password so that no body will be able to view the contents?
Many Thanks,
|
|
|
|
|
How can I update the MDI container statusBar text from the MDI child? can I have an example please...
Jassim
|
|
|
|
|
Has anyone delved into the deep dark secrets of Outlook connectors with C#?
All the references I have seen ("Inside MAPI" and MSDN) show C++ references. In particular, each connector type has a set of launch functions (the main one of which basically goes "create me a COM object and return it") and a set of COM enabled classes.
Now, I'm guessing here that I can fairly reasonably create the COM Classes using COM Interop. What is mystifying me is how do I deal with the launch functions within a C# DLL?
Any ideas?
-Adrian
|
|
|
|
|
Hi,
I've written a custom windows control, that displays an OpenGL scene, but I'm having troubles with it's properties. I can programmatically modify the properties fine, adding objects etc. I can also do this at design time, using the properties window. However, any changes I make at design time don't last, as soon as I run the program, it resets to it's default properties, and then resets in the design window too.
I'm I missing something here? Do I need a special attribute to tell properties to persist, and shouldn't they persist anyway? Otherwise all these design time properties I've added are rather pointless.
Cheers,
Dave
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
I did some work with this a while back. I remember it got tricky depending on the type of your properties.
There is a DesignerSerializationVisibilityAtttribute you can apply to change the default designer serialization behavior. If the property is a collection, you may need
[DesignerSerialzationVisibility(DesignerSerialization.Content)] and a property get that returns the collection.
If you property values are instances of some custom type, you may need to use the DesignerSerializerAttribute .
More detail about the type of the property might be useful.
Burt Harris
|
|
|
|
|
I used the following code to download the source of an HTML page:
<br />
...<br />
try<br />
{<br />
HttpWebRequest _request = (HttpWebRequest)WebRequest.Create(_url);<br />
<br />
if (_useProxy)<br />
{<br />
WebProxy _proxy = new WebProxy(_proxyHost + ":" + _proxyPort.ToString());<br />
_request.Proxy = _proxy;<br />
}<br />
<br />
HttpWebResponse _response = (HttpWebResponse)_request.GetResponse();<br />
<br />
if (_response.StatusCode == HttpStatusCode.OK)<br />
{<br />
Stream _stream = _response.GetResponseStream();<br />
StreamReader _streamReader = new StreamReader(_stream, Encoding.UTF8);<br />
MessageBox.Show(_streamReader.ReadToEnd().Trim());<br />
}<br />
catch (WebException we)<br />
{<br />
}<br />
catch (Exception e)<br />
{<br />
}<br />
...<br />
My question is, what if the page I need to access requires authentication. In other words, when browsing normally, with a web browser client, a dialog pops up asking for my username and password. I have the access information, but I want the preceding code to be able to send that authentication information along and get the code without any user intervention.
Any ideas?
|
|
|
|
|
|
Authentication information is handled via the HttpWebRequest.Credentials property. You can set this to either an instance of NetworkCredential or CredentialCache . See the help under these two classes.
If your using Windows authentication (typically only in a corproate intranet scenario) this works to provide the credentials the current use is logged in with:
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
Burt Harris
|
|
|
|
|
|
I want to contruct a tree view ... but instead of vertical expansion, I want it to expand out horizontally. The intent is to present a navigation view going left to right. Has anyone seen a control like this?
Thanks
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
What kind of application would use this kind of control, wouldn't it give uneasy feeling to the user, because most controls only do a vertical scroll and horizontal scroll only when things could not be shown on the fullscreen.
Kannan
|
|
|
|
|
Kannan,
I stated the application in my post: it is a Navigation view. And moving left to right is more natural than an expanding tree that moves up and down. As to scroll bars....I never said anything about scroll bars in my question.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Does anyone know how I can insert a macro into Excel from C#?
I tried
fExcel.RecordMacro(macro, System.Reflection.Missing.Value);
but that seems to do nothing.
I can find no other way... or even a clue...
Help would be appreciated.
Thanks.
Michel van Meijer.
|
|
|
|
|
Hi,
I just can't figure out how to obtain logical drive information. What I need is the volume label, capacity, etc. I guess by now I know all System.IO classes by heart. Can somebody kick me into the right direction please.
I'm loosing hair over this one...
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
Did you have a look around System.Management ?
Cheers,
Kannan
|
|
|
|
|
I've looked everywhere for functions like the ones you are interested in (and many others), but I suppose some Win32 calls were never ported to the CLR. I have found Environment.GetLogicalDrives(), which is similar to GetLogicalDriveStrings() in the Win32 API. Well, maybe someone else has found others, but I just use the PInvoke/DllImport stuff. Here's some code from one of my projects:
public class Volume {
[DllImport("kernel32.dll", EntryPoint="GetVolumeInformation", CharSet=CharSet.Auto)]
public extern static int
GetVolumeInfo(string sRootPathName,
StringBuilder sbVolumeNameBuffer,
int nVolumeNameSize,
out uint uVolumeSerialNumber,
out uint uMaximumComponentLength,
out uint uFileSystemFlags,
StringBuilder sbFileSystemNameBuffer,
int nFileSystemNameSize);
[DllImport("kernel32.dll", EntryPoint="GetDriveType", CharSet=CharSet.Auto)]
public extern static uint
GetDriveType(string sRootPathName);
[DllImport("kernel32.dll", EntryPoint="GetDiskFreeSpaceEx", CharSet=CharSet.Auto)]
public extern static int
GetDiskFreeSpaceEx(string sAnyPath,
out ulong ulFreeBytesAvailable,
out ulong ulTotalNumberOfBytes,
out ulong ulTotalNumberOfFreeBytes);
}
uint uSerialNum, uMaxEntryLen, uFileSysFlags;
StringBuilder sbLabelBuf = new StringBuilder(260);
StringBuilder sbFileSysTypeBuf = new StringBuilder(260);
int iSuccess =
Volume.GetVolumeInfo("C:\\", sbLabelBuf, sbLabelBuf.Capacity,
out uSerialNum, out uMaxEntryLen, out uFileSysFlags,
sbFileSysTypeBuf, sbFileSysTypeBuf.Capacity);
FWIW, I'm amazed I have any hair left at all
Matthias Steinbart wrote:
In theory, there is no difference between theory and practice. In practice, however, there is.
Love that one.
Cheers
|
|
|
|
|
|
|
I’ve a WinForm application and a TreeView control on it. I’m creating another thread to add data to the control. So far I’m able to achieve this behavior, but sometimes secondary thread is not destroyed. I know it is not recommended, but I’d like to know more about my options and why I should not do this.
Thanks
|
|
|
|
|
You should be able to do this, but you can't do the actual update from the second thread. At least not reliably.
You'll need to use Control.Invoke() on the treeview control. Create a function that does the add on the control, create a delegate to it, and pass the delegate and the parameters to Invoke(). It will then get called on the main UI thread.
|
|
|
|
|
i have a simple network of two computer (xp prof installed on both).i have created a user on both machine with same name and password and both are members of admin.. group.
i have created a service in c# i am running it in local system account.
but i could not access any file on the network of another computer in my service of c#?
could any body help me in this regard?
r00d0034@yahoo.com
|
|
|
|
|
I have an MDI app that opens a child window and the child window performs a long database operation in the Load event. I have added the standard cursor code:
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
...<br />
this.Cursor = cursor;
However, the form does not immediately display so the cursor does not change until the operation is done... and then only briefly. So, I get smart and say:
this.Show();<br />
Application.DoEvents();<br />
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
...<br />
this.Cursor = cursor;
But this does nothing to affect the problem.
--
If it starts to make sense, you're in a cult.
|
|
|
|