|
The Convert class is rarely the best way to do anything; avoid it.
|
|
|
|
|
Hey all together I've got a question I'm using Visual Studio 2010 RC c# developing an Visio Com Add In
I want to add a Simple Button to the CommandBar "Drawing Object Selected"
so I go for
Office.CommandBar commandBar = appVisio.CommandBars("Drawing Object Selected");
which is working fine I tested it with the "...Enabled = False" and the Contextmenu does not appear so this is the right commandBar
now I write the following source. I think the Problem is the ....Add() Method
Office.CommandBarButton commandBarButton = (Office.CommandBarButton)commandBar.Controls.Add(1);
commandBarButton.Caption = "MYButton";
commandBarButton.Tag = "MYButton";
commandBarButton.Enabled = true;
commandBarButton.Visible = true;
commandBarButton.Style = Office.MsoButtonStyle.msoButtonCaption;
commandBarButton.Click += new Office._CommandBarButtonEvents_ClickEventHandler(ButtonClick);
The Button does just not Appear
I hope anybody knows what I do Wrong? Ore is it a Bug?
The wired thing is
In Visual Basic the Code:
CType(commandBar.Controls.Add(1), Office.ComandBarButton) works fine and as far as I know is that the same as
(Office.CommandBarButton)commandBar.Controls.Add(1); in C#
Regards Spixel
Sorry for my not very clever english
|
|
|
|
|
Hi,
How to get country list with country name and two-letter country code like US for United States, FR for France etc. The code needs to get all country names on that system.
I need to retrieve it for a multi lingual software which will get the country list from the OS using C#.
Any help would be appreciated.
Regards,
|
|
|
|
|
See here[^].Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Hi,
Thanx Abhinav for reply. I tried the CultureInfo class from the link u provided but it doesnt satisfy my requirement.
What I need is a list like
Name CountryCode
AFGHANISTAN AF
ÅLAND ISLANDS AX
ALBANIA AL
Also When I run the code using CultureInfo class
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
Console.WriteLine("DisplayName: {0} \nName: {1} \nEnglishName: {2}", ci.DisplayName, ci.Name, ci.EnglishName);
Console.WriteLine("2-letter code: {0}", ci.TwoLetterISOLanguageName);
}
I get the 3rd entry
DisplayName: Catalan
Name: ca
EnglishName: Catalan
2-letter code: ca
It is showing ca as its country code, while we know that CA is the country code for CANADA. I think this only shows the culture info not the country list with country codes.
My problem is that these country names are different in non-english Windows so I have to get these names from the system instead of hard coding them.
I hope more replies to it.
Best regards,
|
|
|
|
|
Hi,
A list of country names with 3 digit code would also satisfy my need.
This list can also work in my case
Name CountryCode
AFGHANISTAN 004
ALBANIA 008
ALGERIA 012
Regards,
|
|
|
|
|
Try this[^]. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi,
I have already googled and found nothing usable.
Regards
|
|
|
|
|
Cyber Friend wrote: I have already googled and found nothing usable.
Well you obviously ignored every link that I found for you. Just picking one at random I found all the international two letter country codes.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi Richard,
Have u read what I have asked in this thread?
I want country names list using C# like
Name CountryCode
AFGHANISTAN AF
ÅLAND ISLANDS AX
ALBANIA AL
Post at least one link in ur next reply which is related to this problem.
Regards,
|
|
|
|
|
|
Hi,
I m lazy? How?
I said "I want country names list using C# like"
So I m looking at ways to get it "using C#".
Plz read my posts before replying to me.
This is a programming forum so I m seeking a programatic solution, The link u provided has already been visited by me.
Regards,
|
|
|
|
|
There is no magic ISO country code class in the framework. you'll need to copy the list into a storage medium (database, text file, xml etc) and write your own code to query it.
|
|
|
|
|
Hi,
Ok I will try to do something for it. Thanx to all of you for your kind participation.
Regards,
|
|
|
|
|
Look, look, I have solved your problem, where can I send my bill???
Countries WebService
Isn't that great, and guess what??? I googled it!!!!, look at this one
List of Culture Codes
and guess what???!!!!! I Googled it too!!!... took me just a few minutes after my last reply, see??? it's very easy and way faster than waiting for some good willing programmers to help you...I want to die like my grandfather- asleep, not like the passengers in his car, screaming!
|
|
|
|
|
Hi,
First of all thanx for googling for me.
Countries WebService
Isn't that great, and guess what??? I googled it!!!!, look at this one
This doesnt satisfy my need because it will always return names in English.
like
<Table> <Name>Afghanistan, Islamic State of</Name> </Table>
I clearly mentioned in one of my above post that I want to get this list from OS System bcoz of Multi linguil aspect of my application. Also I went to the link and invoke GetCountries() method but it only returned the country names, which i think they are getting from some Database.
List of Culture Codes
and guess what???!!!!! I Googled it too!!!
I had already seen this table, but this will be of any use only if I hard code this table in a Database.
BTW thanx for reply.
Regards,
|
|
|
|
|
Then I'm really sorry, but all these sites are ISO based and I don't (I think WE don't) understand what you need, and whatever you need will not be found here and you will have to code it, the 3 numbers you requested were given to you in a link, the 2 letter codes same, I gave you a webservice that gives the information in different ways and even in xml format, the culture codes given to you too... so if nothing helps you out, then I just have to wish you luck and have fun in whatever you're doing I want to die like my grandfather- asleep, not like the passengers in his car, screaming!
|
|
|
|
|
Hi,
I will post some more details tomorow about what I want.
It has some background so I will post a code snippet tomorrow, and then u will be able to know better that What I want. It was my understanding that as it is a basic thing so Microsoft must have provided some Class or method to get this info. Infact MS has provided a Read Only collection of CountryInfo class but problem is that this class is not a documented class, and MS has removed this Read Only Collection of CountryInfo from latest version of the DLL where this class resides. So I thought to get it from some other DLL or Class from .Net framework
Regards,
|
|
|
|
|
Cyber Friend wrote: Have u read what I have asked in this thread?
Yes
Cyber Friend wrote: I want country names list using C# like
And I told you where to find it, I already provided a good list of options, nearly two hours ago. So, if you had followed my advice you would have had a working program by now.
Cyber Friend wrote: Post at least one link in ur next reply which is related to this problem.
Making demands on people who try to help you is considered rude in this forum and may mean that your messages get ignored in the future.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
As I can see, english is not your first language, so perhaps something said in your language that sounds nice and natural translated can be rude for us... anyway... here is a link with the information that you need.
World Atlas and already provided to you
As you will be able to see there, you have A2, A3 and numeric codes for countries, if this doesn't help you and what you want is a full solution for your problem , I'll be more than glad to freelance it for you, as I suspect you'll be using the code for a personal benefit (call it school grades or work) and I want some benefit of it too.I want to die like my grandfather- asleep, not like the passengers in his car, screaming!
|
|
|
|
|
First, let me put your question into other words: Your list should give "US-United Stated, FR-France,etc." on an English windows, "US-Vereinigte Staaten von Amerika, FR-Frankreich,etc." on a German windows etc.
My impression is that this is beyond the grasp of most other people having sent an answer to this thread.
I found a useful link: "How can i get Locale country abbreviation name table of microsoft"[^]
They get a list of all cultures first, then loop through that and get a RegionInfo for each culture - some countries have more than one language, you will have to remove the "duplicates" for your purpose.
RegionInfo.DisplayName shows the country name in the current language.
CultureInfo[] allCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
foreach (CultureInfo c in allCultures)
{
RegionInfo r = new RegionInfo(c.Name);
Debug.WriteLine(r.Name);
Debug.WriteLine(r.NativeName);
Debug.WriteLine(r.EnglishName);
Debug.WriteLine(r.DisplayName);
Debug.WriteLine(r.ThreeLetterISORegionName);
}
Hope this helps.
|
|
|
|
|
I have a small problem to send a collection or array via socket as we know we can only send byte.
This is a small example of what I wanna do but it is not work:
List<string> list = new List<string>();
list.Add("item1");
list.Add("item1");
sockt.Send(list);
I try this small piece of code but I do not received what I need
String username = Console.ReadLine();
String password = Console.ReadLine();
byte[] msg1 = Encoding.ASCII.GetBytes(username);
byte[] msg2 = Encoding.ASCII.GetBytes(password);
List<ArraySegment<byte>> sendBuffers = new List<ArraySegment<byte>>(2);
sendBuffers.Add(new ArraySegment<byte>(msg1));
sendBuffers.Add(new ArraySegment<byte>(msg2));
client.Send(sendBuffers);
List<ArraySegment<byte>> recvBuffers = new List<ArraySegment<byte>>(2);
byte[] username = new byte[10];
byte[] password = new byte[10];
recvBuffers.Add(new ArraySegment<byte>(username));
recvBuffers.Add(new ArraySegment<byte>(password));
try
{
int bytesReceived = sock.Receive(recvBuffers);
}
catch
{
}
sockt.Received(recvBuffers);
Now if in Client enter
toto as username and 123456 as password
in server I received toto123456 no totoand 123456 seperatly
What can I proceed.
|
|
|
|
|
You need to convert your messages into continuous byte streams, rather than sending multiple messages. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Shouldn't the client wait for a prompt before sending the data? And perhaps include a carriage return?
|
|
|
|
|
Im trying to search for the tag within a text file,when i found it then i want to delete it, can you please help me to delete the tag.
public partial class Display : System.Web.UI.Page
{
StreamReader myread;
string pic;
string readtxt;
string[] heading = new string[1000];
int count;
protected void Page_Load(object sender, EventArgs e)
{
pic = "<img[^<>]+>";
count = pic.Length;
try
{
string mine = Server.UrlDecode(Request.QueryString["mine"]);
readtxt = Server.MapPath(mine);
using (myread = File.OpenText(readtxt))
{
for (int i = 0; i < 500; i++)
{
do
{
if (!myread.EndOfStream)
{
heading[i] = myread.ReadLine();
lbldisplay.Text = String.Join(" ", heading, 0, 500);
}
}
while(heading[i].Contains(pic));
{
lblTry.Text = count.ToString();
heading[i].Remove(200,count);
im having a broblem here
}
}
}
}
catch(Exception ex)
{
lblerror.Text= ex.Message;
}
}
}
}
|
|
|
|