|
Hi,
Thanks for your help. However, I am using System.Web.UI.WebControls.Table class that has a BorderStyle property, so obviously I should NOT get this error, but for some reason I am geting this error. Also this not a WPF project. Any idea what could be wrong, I am using VS 2005. Please help if you can.
Thanks
A.Asif
|
|
|
|
|
Well, since you just specified "Table" and not "System.Web.UI.WebControls.Table" explicitly, you're using a Table class from a different namespace. That's why yo're getting this message. Change the code to be specific and you won't see this error.
|
|
|
|
|
Hello,
I no really nothing about unicode. So I am trying to convert a string that starts out in English and convert it to Japanese. This is what I am doing, but I have no idea what to do and nothing is coming out as Japanese. I tried looking on the internet and the best thing I found was this. http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx
But I still can't get it to convert the string. This is what I have for code written so far. Please help. I would expect "This is a Test" to convert to Japanese but it does not.
string TestString = "This is a Test";
Encoding ascii = Encoding.GetEncoding(932);
Encoding japanese = Encoding.GetEncoding(20127);
byte[] unicodeBytes = ascii.GetBytes(TestString);
byte[] JapaneseBytes = Encoding.Convert(ascii, japanese, unicodeBytes);
char[] JapaneseChars = new char[japanese.GetCharCount(JapaneseBytes, 0, JapaneseBytes.Length)];
japanese.GetChars(JapaneseBytes, 0, JapaneseBytes.Length, JapaneseChars, 0);
string JapaneseString = new string(JapaneseChars);
string test = System.Text.Encoding.GetEncoding(932).GetString(JapaneseBytes);
I just tried this and the string is still in English. I am just looking at the string in the debugger to see what it looks like and it is still english.....
modified on Friday, September 12, 2008 1:45 PM
|
|
|
|
|
Are you trying to translate the text in the string? There is no conversion or encoding that can do that for you.
A proper translation can only be done by a human. There are some pages on the web where you can get an automatic translation, that is at least usable.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Well, what I am trying to do is say, a person types in an 'a', I can then take that letter and translate it to the Japanese representation of 'a' or what the japanese representation of the key pressed on the keyboard for for 'a' which I think is key 65.
|
|
|
|
|
I don't know alot about Japanese, but I don't think the Japanese alphabet can be compared to the Latin (our) alphabet. Japanese and Chinese characters are syllables, no letters. I also think the Japanese alphabet has alot more characters than ours.
Edit: People that want to see Japanese characters will need the East-Asian characters to be enabled with their OS. Check this Wikipedia page for more information how to do this (not too hard).
http://en.wikipedia.org/wiki/Help:Multilingual_support_(East_Asian)[^]
|
|
|
|
|
So there is no way to convert a single key press to the Japanese representation of that key press?
|
|
|
|
|
No, because there is no relationship between the two languages. Any translation of a letter in English language is an approximation of the CONCEPT of 'a' in Japanese. For instance, there may not be anything like an 'a' key, or whatever key you hit, on a Japanese keyboard. One character can represent a word, like "Song", and may even represent an entire paragraph in English.
Last I heard, in Japanese Kanji, there were over 4,000 characters!
|
|
|
|
|
SRogers88 wrote: I no really nothing about unicode.
I would suggest reading this article[^] for a good introduction.
|
|
|
|
|
Hi,
i can use this code to change the ownership of a directory
*********************************************
DirectoryInfo dInfo = new DirectoryInfo(folderPath);
DirectorySecurity oDirectorySecurity = new DirectorySecurity();
NTAccount owner = new NTAccount("Administrators");
oDirectorySecurity.SetOwner(owner);
dInfo.SetAccessControl(oDirectorySecurity);
*********************************************
but does anyone know how to make this recursive, so it changes the owner of all the sub files and folders?
Many Thanks,
Phil
|
|
|
|
|
use Directory.GetDirectories and Directory.GetFiles instead
and do it recursively
hope it help
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
great, thanks.
works a treat.
|
|
|
|
|
Is there a way to specify a class inherited from a generic list object to serialize its children with a specific tag name? For instance, I want:
[Serializable(), XmlRoot("Products")]
public class ProductList : List<Product>
to output as
<Products>
<Content>
</Content>
</Products>
not as
<Products>
<Product>
</Product>
</Products>
It seems I can only use the XmlArrayItem attribute on fields/properties/etc, not on classes. Placing an XmlRoot tag on the Product class doesn't get me the results I want either. Thanks in advance!
modified on Friday, September 12, 2008 12:52 PM
|
|
|
|
|
Works for me....
[Serializable(), XmlRoot("Products")]
public class ProductList : System.Collections.Generic.List<Product>
{
public ProductList()
{
}
public void Load()
{
this.Add(new Product("111"));
this.Add(new Product("222"));
this.Add(new Product("333"));
}
}
public class Product
{
public string Name;
public string Test;
public Product()
{
}
public Product(string val)
{
Name = val;
Test = "Default " + val;
}
}
I do this in the test app:
ProductList p = new ProductList();
p.Load();
..and then serialize and get this....
<?xml version="1.0" encoding="utf-8"?>
<Products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Product>
<Name>111</Name>
<Test>Default 111</Test>
</Product>
<Product>
<Name>222</Name>
<Test>Default 222</Test>
</Product>
<Product>
<Name>333</Name>
<Test>Default 333</Test>
</Product>
</Products>
Erik Westermann - wWorkflow.net - BizTalk Consulting Services
SOA * ESB * BPI * SaaS ... forget the alphabet soup - get the main course with our consulting services!
wWorkflow.net or +1 416-809-1453
|
|
|
|
|
IM working on a small C# program to backup My Access database automatically and woould like to add a few bells and whistles. Id like to be able to open the selected database from the program in exclusive and non-exclusive mode. Ive read the articl on SMSDN about Access automation as well as others but still have a problem.
using Access = Microsoft.Office.Interop.Access;
.......
private void btnOpenCurrDB_Click(object sender, EventArgs e)
{
Access.Application oAccess = new Access.ApplicationClass();
if (cbExclMode.Checked == true)
{
oAccess.OpenCurrentDatabase(@"C:\FTTH.mdb", true,null);
}
else
{
oAccess.OpenCurrentDatabase(@"C:\FTTH.mdb", false,null);
}
}
When I run the program, and click on the OpenCurrDB button I get 'InvalidCastException was unhandled'
Unable to cast COM object of type 'Microsoft.Office.Interop.Access.ApplicationClass' to interface type 'Microsoft.Office.Interop.Access._ApplicationClass'. The exception cmoes in either of the two oAccess.OpenCurrentDatabase lines depending on whether or not I have the exclusive checkbox checked.
Im a novice programmer, the rest of my program works fine, I just cant seem to get my hand on this part.
|
|
|
|
|
Problem solved. My machine is x64. I went into the project tab and changed the target CPU to x86. Works like a champ now.
|
|
|
|
|
how can i move the location of gorupbox in winform...
i want to change the locatoin of groupbox...
mean first time when form loads, its location is change and after some time its location should be changed.
--------------------------------------------------------------------------------
hghghgh
|
|
|
|
|
groupBox1.Location
Eslam Afifi
|
|
|
|
|
this.groupBox1.Location = new Point(100, 150);
maifs
|
|
|
|
|
how can i change i item's order in listbox in winForm( i have VS2005)..
i want that when i add some text in listbox then it should be appear from bottom to top
maifs
|
|
|
|
|
Implement IComparable on your object, and set Sorted = true .
|
|
|
|
|
Hi,
could anyone help me and tell me how i could change the following code so that the resulting xml would have nillable="true" on the field elements so that null values are represented with xsi:nil="true" in the xml?
SqlConnection MSSqlConn = new SqlConnection();
SqlCommand MSSCommand = new SqlCommand();
SqlDataAdapter MSdataAdapter = new SqlDataAdapter();
DataTable MyDT = new DataTable("TestQuery");
MSSqlConn.ConnectionString = str_con;
MSSCommand.Connection = MSSqlConn;
MSSCommand.CommandText = "select * from order_header where order_header.order_date = '09/13/2008'";
MSdataAdapter.SelectCommand = MSSCommand;
MSdataAdapter.Fill(MyDT);
MyDT.WriteXml("c:\\testquery.xml", XmlWriteMode.WriteSchema);
|
|
|
|
|
Hi there,
I'm new to C# and .NET and just wandering if there is anything clever that I could download (library, etc.) or maybe is part of the standard C# library that could help this:
In an import scenario (of tousands of articles) I have a column in the database that contains links. This is a very messy database (from a CMS) and some of the links are www.somelink.com (the good ones), etc. some are actualy with the html tag <a href="http://somelink.com">www.somelink.com</a>
I was wandering if there is a regular expression anywhere that would help me to filter out the Web link?
In the worst case scenario I'll have to write it myself - not a huge worry but would prefere to resuse of course.
Any help much appreciated.
Kind regards,
Pav
|
|
|
|
|
<a.+?href>]*>(?<text>.+?)
should about do it
I just wrote that for you, should get you three named match groups: "HREF", "Domain", "Text".
My test data was:
asd
asd
asd
asd
asd
all matched correctly.
--
Real programmers don't comment their code. It was hard to write, it should be hard to understand.
|
|
|
|
|