|
You should use the method supplied by the .NET Framework called TextInfo.ToTitleCase() ; it's in the System.Globalization namespace, the easiest way to acquire the TextInfo object is to retrieve it from the CurrentCulture like so:
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("mert efe");
MSDN Reference: http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.totitlecase.aspx[^]
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
|
|
|
|
|
hii Ben
thanks for you reply..i tried the method u suggested it is really good method..but i want to ask one more question about it...for example we have capital i like "İ" in turkish but it writes like I when it makes it capital..i think it is because of
TextInfo myTI = new CultureInfo("en-US",false).TextInfo;
so how i can use turkish characters instead of english ?
|
|
|
|
|
erdinc27,
You'll need to get the code letters for the Turkish culture, I'm not sure what they are but you should be able to find them rather quickly by searching the 'Net. Once you have those code letters you'll replace the "en-US" code with the Turkish code, then it will operate on the string using the Turkish alphabet.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
|
|
|
|
|
Does the IPv6 protocol deal with UDP datagrams ???
|
|
|
|
|
|
The IPv6 protocol only deals with IPv6 packets - which might happen to contain an UDP datagram, or not. It doesn't care, it just sends a bunch of bytes, it's up to Transport Layer and above to make sense of it.
|
|
|
|
|
Hi all...
As calling an 'ipAddress' from class 'Sockaddr' to find the local IP address of my PC, it always return an IP address 255.255.255.255 for IPv4, and ffff.ffff.ffff.ffff for IPv6.
the class 'Sockaddr' belongs to 'SharpPcap-2.1.1', the implementation of the class is as follwo:
using System;
using System.Runtime.InteropServices;
using System.Net.NetworkInformation;
namespace SharpPcap.Containers
{
public class Sockaddr
{
public enum Type
{
AF_INET_AF_INET6,
HARDWARE,
UNKNOWN
}
public Type type;
static public System.Net.IPAddress ipAddress; // if type == AF_INET_AF_INET6
public PhysicalAddress hardwareAddress; // if type == HARDWARE
private int _sa_family;
public int sa_family
{
get { return _sa_family; }
}
public Sockaddr(PhysicalAddress hardwareAddress)
{
this.type = Type.HARDWARE;
this.hardwareAddress = hardwareAddress;
}
public Sockaddr(IntPtr sockaddrPtr)
{
// A sockaddr struct. We use this to determine the address family
PcapUnmanagedStructures.sockaddr saddr;
// Marshal memory pointer into a struct
saddr = (PcapUnmanagedStructures.sockaddr)Marshal.PtrToStructure(sockaddrPtr,
typeof(PcapUnmanagedStructures.sockaddr));
// record the sa_family for informational purposes
_sa_family = saddr.sa_family;
byte[] addressBytes;
if(saddr.sa_family == Pcap.AF_INET)
{
type = Type.AF_INET_AF_INET6;
PcapUnmanagedStructures.sockaddr_in saddr_in =
(PcapUnmanagedStructures.sockaddr_in)Marshal.PtrToStructure(sockaddrPtr,
typeof(PcapUnmanagedStructures.sockaddr_in));
ipAddress = new System.Net.IPAddress(saddr_in.sin_addr.s_addr);
} else if(saddr.sa_family == Pcap.AF_INET6)
{
type = Type.AF_INET_AF_INET6;
addressBytes = new byte[16];
PcapUnmanagedStructures.sockaddr_in6 sin6 =
(PcapUnmanagedStructures.sockaddr_in6)Marshal.PtrToStructure(sockaddrPtr,
typeof(PcapUnmanagedStructures.sockaddr_in6));
Array.Copy(sin6.sin6_addr, addressBytes, addressBytes.Length);
ipAddress = new System.Net.IPAddress(addressBytes);
} else if(saddr.sa_family == Pcap.AF_PACKET)
{
type = Type.HARDWARE;
PcapUnmanagedStructures.sockaddr_ll saddr_ll =
(PcapUnmanagedStructures.sockaddr_ll)Marshal.PtrToStructure(sockaddrPtr,
typeof(PcapUnmanagedStructures.sockaddr_ll));
byte[] hardwareAddressBytes = new byte[saddr_ll.sll_halen];
for(int x = 0; x < saddr_ll.sll_halen; x++)
{
hardwareAddressBytes[x] = saddr_ll.sll_addr[x];
}
hardwareAddress = new PhysicalAddress(hardwareAddressBytes); // copy into the PhysicalAddress class
} else
{
type = Type.UNKNOWN;
// place the sockaddr.sa_data into the hardware address just in case
// someone wants access to the bytes
byte[] hardwareAddressBytes = new byte[saddr.sa_data.Length];
for(int x = 0; x < saddr.sa_data.Length; x++)
{
hardwareAddressBytes[x] = saddr.sa_data[x];
}
hardwareAddress = new PhysicalAddress(hardwareAddressBytes);
}
}
}
}
Do anyone can help me ???
Thanks.................
|
|
|
|
|
Hi,
your code seems a bit complicated. Did you know that there is some framework implementation to obtain the local ip-adress?
Check out this article:
How To Get IP Address Of A Machine[^]
Hope this helps.
Regards
Sebastian
|
|
|
|
|
Hi Sebastian,
such techniques return the local IP address, i.e. the address is valid on the LAN, but in general not on the internet. To get the "external" IP address, one really needs an external web service, and I happen to offer one here: http://www.perceler.com/tools1.php[^].
|
|
|
|
|
Hi all,
Any idea how to handle an C# event in a Excel?
eg. invoke Excel action with a C# timer event.
(I can article "C# handle Excel's event" but not "C# event in Excel")
thank you!
Jim
|
|
|
|
|
You're going to have to explain what you mean and which "event" and how this code is setup. Are you using the Excel Object Model in your C# code?? Or did you write an application in C$ that Excel is running through a Shell statement, or something similar??
|
|
|
|
|
I am not sure about the Excel Object Model.
I want to have a C# library I can call a C# function, which i have done with help of below article.
http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx
I also want to have setup callback, event in the C# space and i can get the callback/event inside Excel.
eg. i have an event like below, i can get the event with AlarmEventHandler. I just want to have such event happening in Excel.
(below code copied from msdn)
public class AlarmClock
{
public event AlarmEventHandler Alarm;
protected virtual void OnAlarm(AlarmEventArgs e)
{
if (Alarm != null)
{
Alarm(this, e);
}
}
}
public static void Main (string[] args)
{
WakeMeUp w= new WakeMeUp();
AlarmClock clock = new AlarmClock();
<big> clock.Alarm += new AlarmEventHandler(w.AlarmRang);</big>
clock.Start();
}
|
|
|
|
|
Yes, you can do this. Go read MSDN articles about Office Interop and you'll soon be able to do this and much more - as long as your code only needs to work with the later incarnations of Office.
|
|
|
|
|
Hi all,
can any one please tell me how can i read from a file which resides in net work drive?
Regards
Lijo
|
|
|
|
|
As a usual file (e.g. System.IO.File.ReadAllText(...) ) Doesn't it work?
|
|
|
|
|
my file resides in remote system. from that system only i want to read a file. can you please tell me how can i do that?
Regards
Lijo
|
|
|
|
|
This can be done in 3 ways:
1. Map the remote drive (this means, assing e.g. Z: letter to the drive)
2. Read from this location: \\remote-computer\Share\path\file.txt . In this case, the file must be shared in Share folder on the remote computer.
3. If you are running under the credentials of the administrator on the remote computer (this means that two computers are in the same domain), you can read directly from this path: \\remote-computer\C$\path\file.txt .
|
|
|
|
|
Please see also my answer in this thread on CodeProject: [^]
|
|
|
|
|
It's the same as when you read a file from your local drive.
Why would you think it would be any different?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi,
I have a C# application that generates an organization chart using the Microsoft Visio Org Chart Wizard. It works just fine but i was wondering if it were possible to place the items on the chart at a custom position. Right now, the items are placed starting at the top of the page and i'd like them to start a bit lower.
Thanks
|
|
|
|
|
hi, it is posible that you share your code????
=)
|
|
|
|
|
how i can remove this full tag
<item><br />
<tag1>OK</tag1><br />
<tag2>button OK</tag2><br />
<!-- button2 --><br />
</item>
in this resource file
<resources>
<item>
<tag1>OK</tag1>
<tag2>button OK</tag2>
<!-- button2 -->
</item>
<item>
<tag1>0,0</tag1>
<tag2>button OK</tag2>
</item>
<item>
<tag1>75,23</tag1>
<tag2>button OK</tag2>
</item>
</resources>
|
|
|
|
|
|
|
hi,
i have created a report using report viewer nw i want to make border of some cells double on the basis of a criteria.hw can i do this.
Regards
Ali
|
|
|
|