|
Thanks. But it is not working. I used the enter key to return to the next line. I did that through a couple of lines before typing the data. Now what I need to do is remove those return characters from the beginning while keeping the format.
thx
Nana
|
|
|
|
|
Well those are not spaces, so logically it will not work, eh?
Then you will have to use the Replace method, figuring out the algoritm shouldn't be to hard...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
|
Hi All,
This might stem back to 'C' days and I probably ought to change my 'mindset' and other such phrases but old habits die hard. Call me Cliché Man...
When I write an applicaton, I tend to have a source file or two put aside to put all 'those little useful functions' in. You know, generic things like formatting a postal code, validating things etc. that don't fit in with a specific class anywhere. Well, using C#, I've implementing this as follows:
In library.cs:
<br />
namespace mylib {<br />
public class rog {<br />
static public int DoSomething(int arg) {<br />
return arg+1;<br />
}<br />
}<br />
}<br />
To call this function, I'm putting this in app1.cs:
<br />
using mylib;<br />
...<br />
b = rog.DoSomething(3);<br />
This seems like using a class where there is really no need. I'd like to just call 'DoSomething(3)' without the 'rog.' part.
I'm new to C# so be gentle, I'm old to C and C++ so feel free to be harsh.
Am I being stupid?
Thanks for any confirmation or denial...
Rog
|
|
|
|
|
You can't have methods without a class in C#...
So considering that your aproach is ok, but maybe not so OOish
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
You can't do that in C#
In latest java (1.5) you can do static import and in C# 2.0 you can have static class that will force you to have only static members and can't instentiate that class.
One possible (but not recommended) solution would be to have
class rog
{
... static methods here...
}
class myclass : rog
{
... now you can call methods of rog without rog.
}
|
|
|
|
|
That's sort of what I'm after - I didn't think of deriving my class from the library - seems a roundabout way of resolving the function names though.
What I'm after really is a way of defining functions in the same way as you would, for example, the 'sin()' function as I'd much rather use:
result = sin(pi*4);
then
result = rog.sin(pi*4);
The library doesn't have any actual data (or if it is, it'll be static) and I don't intend to instantiate an instance of it.
I still have this nagging feeling that I just haven't 'got the hang' of C# yet...!
Rog
|
|
|
|
|
Hi everybody!! Is it possible to bind a bidimensional array of double to a datagrid?if yes how can i do this?
I can't manage this.
Thank you so much
Alessio
|
|
|
|
|
You wrote:
8) now place the encryption/decryption key in the registry and lock it down with security so that only your application has the rights to read it.
what do you mean about registry, and "lock it down with security.."?
|
|
|
|
|
Please reply to the appropriate message rather than start a new thread. If "RealCondor" has elected to receive email notifications of a replies to his post then he'll get an email telling him that - there is even less of a guarantee that he'll see this message.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
iam building chat application.It connects will in LAN between networked PC(s) && also successful in connection on my own localhost on the same pc . But the Problem is That when i gave my friend the client application and ran my server. I gave him then my ip address . But it can't connect to my ip address whereas iam running my server application so well iam not firewalled also . Iam using dial up and he is using dial up also. I tested it with one of my friends using DSL but the problem is the same.
How can i make it connect to any user on the internet by knowing his ip address and port assume that they are not behind firewall or NAT's or anything ?
Human Knowledge Belongs To the world
|
|
|
|
|
First, make sure that your server isnt listening on "127.0.0.1". While this will work for your computer (localhost), no one else will be able to connect to it. Next, try getting an IPAddress from Dns.Resolve(Environment.MachineName).AddressList[0]. This will enable your server to listen on the correct address for any computer you place it on. Then you just have to give whoever else the IP Address of your server so they connect, and it SHOULD fix your problem. If it still doesnt, try checking your Windows Firewall.
C#Guy
|
|
|
|
|
So it works fine on your LAN. You client has a DHCP address and your server has a static IP correct?
Well your static IP is visible on your LAN but not on the WAN. Your dialup ISP probably can if not already assign you a static IP. The WAN IP is gloablly accessible (i.e. via the Internet). Inside your premise (house) you will also have to setup routing so that the PORT your chat server is running on can have public data routed to it. For example if you have a Linksys Router check out Advanced->Port Forwarding.
For testing, if you can dialup and then connect to the public IP / Port then you should be in good shape. However until you get to the point where you can connect, tell you friends to hold off.
Good luck
Mike Luster
|
|
|
|
|
So what do i have to do to make my friends connect to me !!! and i want to be able to connect to any ip address on the internet by knowing the ip address and the port number ???? like any remote administration tool like subseven or prorat or any others how could they do that ?
i need clients in voice session , the voice is directed to each one pc without the interfere of the server it will be so heavy for the server to handle text and voice at the same time
Mess With The Best And Die Like The Rest
|
|
|
|
|
This does appear to work, however is this really how you're supposed to do it:
I'm calling the WinSpool API method EnumPrinterDrivers:
[DllImport("winspool.drv", CharSet=CharSet.Ansi, SetLastError=true)]
public static extern bool EnumPrinterDrivers
(
[MarshalAs(UnmanagedType.LPWStr)] string pName,
[MarshalAs(UnmanagedType.LPWStr)] string pEnvironment,
uint Level,
IntPtr pBuff,
uint cbBuf,
out uint pcbNeeded,
out uint pcReturned
);
In C speak The pBuff would be a pointer to an array of DRIVER_INFO_1 structs. I have declared these as:
[StructLayout(LayoutKind.Sequential)]
public struct DRIVER_INFO_1
{
[MarshalAs(UnmanagedType.LPStr)] public string sName;
}
Heres my method, it's the pointer arithmatic that I'm curious about, seems to be very clumsy:
public static unsafe string[] ListPrinterDrivers()
{
string[] arrDrivers = new string[]{};
try
{
uint nNeeded = 0;
uint nCount = 0;
IntPtr ptrData = IntPtr.Zero;
//how much do I need
EnumPrinterDrivers(null, null, 1, ptrData, 0, out nNeeded, out nCount );
if ( nNeeded > 0 )
{
//alloc space for array
ptrData = Marshal.AllocHGlobal((int)nNeeded);
bool bOK = EnumPrinterDrivers(null, null, 1, ptrData, nNeeded, out nNeeded, out nCount );
if ( bOK && nCount > 0 )
{
arrDrivers = new string[nCount];
IntPtr ptrArrStructs = ptrData;
for ( int idx=0; idx< nCount; idx++ )
{
DRIVER_INFO_1 dinfo = (DRIVER_INFO_1)Marshal.PtrToStructure(ptrArrStructs, typeof(DRIVER_INFO_1));
System.Diagnostics.Debug.WriteLine("Got Printer driver: " + dinfo.sName );
arrDrivers[idx] = dinfo.sName;
//
//OK so now I increment the pointer. Is there a better way
//
int nSize= Marshal.SizeOf(dinfo);
byte* ptrStruct = (byte*)ptrArrStructs.ToPointer();
ptrStruct += nSize;
ptrArrStructs = new IntPtr((void*)ptrStruct);
}
}
Marshal.FreeHGlobal(ptrData);
}
}
catch ( Exception exp )
{
System.Diagnostics.Debug.WriteLine(exp.ToString());
}
return arrDrivers;
}
|
|
|
|
|
Hi there,
I have a form with a data grid. when i click on the header portion, an arrow is shown there wrt the order of sorting . I'm planning to do a multi column sorting. I'l be usinb a key (shift/Ctrl) to select the columns.
When i select more than one column using a particular key, the arrow should be there on all the selected columns headers.
Is there a way to show the arrow on multiple column headers???
Thanks
Els
|
|
|
|
|
Hi All,
I have an application which navigate a URL in AxWebBrowser. According to my application the URL will be navigated for more than 1000 times. I am clearing the cache after every navigation.
The problem is... when I start executing the application and open any other page and again trying to view the execution the window is not shown properly.
Can any body please help me in this case?
Thanks in Advance
Jaya
|
|
|
|
|
Is there a way to programaticaly add a .gif image toa richtextbox. I found an article that is using the rtf pecifications but I am just a beginer and I can`t understand wery well the code. Is there an easyer way?
|
|
|
|
|
I'm looking for a way to bypass the Outlook Object Model Guard via C#, without Redemption.
The sharing of good or bad things between living beings, is what accounts for happiness or suffering.
|
|
|
|
|
The security is pretty tight. Without Redemption you have to write the bypasses yourself. Check the Redemption info to see what protocol they use for their "SafeMailItems". I used to know what it was, but I know its not MAPI. It is a big undertaking and you may well be better off just getting the Redemption redistributable. I seriously doubt it will be a simple solution to bypass SP2 security.
C#Guy
|
|
|
|
|
Hello,
I try to get the SUM out of the values of an Excel.range
like: range2[1,1] = SUM(range1);
Thanks
|
|
|
|
|
how to serialize a folder
|
|
|
|
|
Please clarify. Do you want to package the contents of a folder (including files and files under subfolders) as a binary file?
Option A: You can Zip them using SharpZipLib
Option B:
Instantiate an object of type Hashtable.
Recursively traverse through the directory and subdirectories.
Read the file contents and push it as the value in the hashtable using file name as the key.
Implement your custom serialization for hashtable.
|
|
|
|
|
Does anyone know where a Form saves its previous window location and size when it is maximized? When the From is subsequently restored from its maximized state to its "normal" state, it must somehow retrieve these numbers, but how? I like to be able to retrieve this information so I can save it.
Any clues would be appriciated.
|
|
|
|
|
why dont u take the current size of the form before maximizing. u can do the same through wndproc and save it
Els
|
|
|
|