|
i am trying to use my own calendar class derived from the abstract calendar class in System.Globalization i need my custom calendar because what i want is ethiopian calendar, the calensar works OK, but the problem is there is no culture specified by microsoft for ethiopian (Amharic) Language so i've gotten away by using other culture and changing editable parts of it for globalization,localization of the application; now the problem is i can not assign a calendar for any culture, i need it for local date conversion & automatic formatting is there any way to get around this.
|
|
|
|
|
I was waiting for a reply any of u guys never run to this...
|
|
|
|
|
I have different date formats for eg.
1) dd-MM-yyyy
2) MM-dd-yyyy
user can prefer to have one format in the preferencess tab.
and he enters a date 06/05/2005
in format a i have to read it as 06-May-2005 ie 20050506T00:00
in format b i have to read it as 05-Jun-2005 ie 20050605T00:00
How do i say that read the date as per the specified format.
Is it possible to have a function like
public datetime ParseExact_Custom(strDate,strInputFomrat,strOutputFormat)
{
............
//what should i do here ??
//if you can convert them to "s" also would be greate.
}
if any body please could help me i will be thank full
Vinay Bhushan.S
Vinay Bhushan.S
|
|
|
|
|
From MSDN:
The following sample demonstrates the ParseExact method.
string strMyDateTime = "2/16/1992 12:15:12";<br />
<br />
System.DateTime myDateTime =<br />
System.DateTime.Parse(strMyDateTime);<br />
<br />
System.IFormatProvider format =<br />
new System.Globalization.CultureInfo("fr-FR", true);<br />
<br />
string strMyDateTimeFrench = " 16/02/1992 12:15:12";<br />
<br />
System.DateTime myDateTimeFrench =<br />
System.DateTime.Parse(strMyDateTimeFrench,<br />
format,<br />
System.Globalization.<br />
DateTimeStyles.NoCurrentDateDefault);<br />
<br />
string[] expectedFormats = {"G", "g", "f" ,"F"};<br />
myDateTimeFrench = <br />
System.DateTime.ParseExact(strMyDateTimeFrench,<br />
expectedFormats,<br />
format,<br />
System.Globalization.<br />
DateTimeStyles.AllowWhiteSpaces);<br />
---
b { font-weight: normal; }
|
|
|
|
|
I know this is in the MSDN
but i dont want to apply any culture here i have two very specific date formats and i have to treate the string in that format as date.
is there a possibility or i have to write a custom split join and create a new date object form them or its possible to format andy given string in any format.
Regards
Vinay
|
|
|
|
|
The CultureInfo object contains a DateTimeFormatInfo object that tells the parser how to parse the string. You can use just a DateTimeFormatInfo object as format provider, and create the object with any settings you like.
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
How can I change the colour of the rows in the datagrid, depending on the row number?
Thank you,
|
|
|
|
|
Hi,
i've developed an application that makes use of crystal reports... when i test the ap on a machine that only has the .NET framework installed i get the following error
"Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0,Culture=neutral,PublicKeyToken=692fbea5521e1304' or one of its dependancies. The system cannot find the file specified."
i guess this means that the referenced assemblies are not being included/generated/ copied to the output directory... in either case, how do i overcome this set back??
i always assumed that if i developed an app that used Crystal reports that when i deploy, the IDE (VS2005 in my case), would create the necessary assemblies...
any jelp would be great,
Thanks
Afzal "AV-E" Hassen
|
|
|
|
|
Unsure about vs2005, but in vs2003, you need to include the assemblies in the setup/deployment package.
When you do this, you have to enter the license key you got when you registered crystal reports. This get built into the package. When the package is installed on another pc, all the relevant files for CR are installed aswell.
Check out http://www.crystaldescisions.com There's some knowledgebase stuff in the support section explaining how to do it.
Andy
|
|
|
|
|
Hi there,
I'm creating a Windows Forms Application that primarly uses User and other derived Controls in order to extend their properties.
One of the property is a collection - the type is derived from System.Collections.CollectionBase. The type of the elements is a class which only contains some data elements.
To have a user friendly selection in the property grid of Visual Studio a type converter class is implemented for both - the collection and the elements class. The Serializable-Attribute is set too, and the ToString-Method is overriden for the elements class.
The controls using the classes described above works fine in the Forms Designer except cut or copy an element into the clipboard produces a message box with the text
The type MyApplication.Controls.MyControl in Assembly ... is not marked as serializable.
FYI: The collection and item class is defined in a sepparate Assembly and the Controls are also in a different Assembly.
Any suggestions are welcome
Thanks in advance
Horst
|
|
|
|
|
Hi there.
I'm fiddling around with arrays and i need to collapse (re-arrange) an array. Currently i have no clue how to do it, so if anyone could help out with a little example or some hints i would be thankful.
An example of what i want to do:
---------------------------------
An array containing 5 elements
1 - 2 - 3 - 4 - 5
If i remove element index 3 from the array i want the index of element 4 to change to 3 and the index of element 5 to chance to 4. How is this possible?
Thanks alot in advance!
|
|
|
|
|
Create a temp array, copy all the other elements to it, then assign the temp to the old array.
|
|
|
|
|
Take a look at the ArrayList.
|
|
|
|
|
I have a simple class:
public class Test
{
public Test()
{
}
public string name;
public int age;
}
and part of the code used in de/serialization:
Test c;
Test a = new Test("martinez", 21);
Test b = new Test("kate", 20);
TextWriter tw = new StreamWriter("c:/text.txt");
System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(Test));
ser.Serialize(tw,a);
ser.Serialize(tw,b);
tw.Close();
TextReader tr = new StreamReader("c:/text.txt");
c = (Test)ser.Deserialize(tr);
tr.Close();
And here pops an error
An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll
Additional information: There is an error in XML document (12, 3).
, why I can`t deserialize an object from that file?
Further question - may I keep different sort of objects in one file? If so, how to check if read object is the one I was looking for?
thank you for any help
|
|
|
|
|
Hi,
i have developed a user control, when i put the user control with a larger size from its originalone on a form, only the original size is shown, it is like when a picture is shown in a picturebox with property streach set to false.
I want to do streach the user control to the size it is on the form &
i want a lebel to be 8 pixel down fromits top no mater what is its size on the form (i want to control the locations of the internal control)
Can anyone help me
Regards,
Arus
|
|
|
|
|
hi
im trying to create a number of radiobutton in runtime.
int i = 0;<br />
while (TempString != null)<br />
{<br />
if (TempString.Length > 3) <br />
{<br />
RadioButton rbNew = new RadioButton ();<br />
rbNew.Name = (rbNew.Name.ToString() + i.ToString());<br />
rbNew.Text = TempString;<br />
rbNew.Visible = true;<br />
pnVSSProjects.Controls.Add(rbNew);<br />
<br />
}<br />
i++;<br />
<br />
}
but it only create the first RadioButton and not the others.
please help.
thanks
Have a nice Day
-- modified at 8:37 Wednesday 14th September, 2005
|
|
|
|
|
liqnit wrote:
RadioButton rbNew = new RadioButton ();
rbNew.Name = (rbNew.Name.ToString() + i.ToString());
rbNew.Text = TempString;
rbNew.Visible = true;
pnVSSProjects.Controls.Add(rbNew);
You're not setting the Top and Left properties of the controls you're creating to move them around the container they're in. This means that each one is being put in the exact same place, so the first one created is the only one you actually see. All the others are behind it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks
it's working great now
Have a nice Day
|
|
|
|
|
Hi All,
In my application User selects the file which is *.dll by browsing on the System. Now i want to find out this dll is .NET assembly or Com dll.
How should i find out the Dll is Managed dll or unmanaged dll programatically??
Thanks,
TusharM
|
|
|
|
|
Try to Load the dll file in a try catch block. You will recieve a System.BadImageFormatException
for unmanaged dll's.
try
{
Assembly.LoadFrom(@"C:\WINDOWS\acb.dll");
}
catch(System.BadImageFormatException ex)
{
MessageBox.Show(ex.Message);
}
catch ( Exception ex )
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
If i create a file or whatever can i give it a protected status?
Once thats done would it be possible to remove it as well?
|
|
|
|
|
What do you mean by "protected status"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How, can I call an excel macro fom C#?
Thanks
|
|
|
|
|
do not know exact code for Excel but I just dug through simular
thing (only with MS Outlook ), you can use Interop to dig down all objects in Excel.
1. set referense in solution explorer to ms excel com library(COM tab).
2. get a handle of Excel namespace:
using nsExcel=Microsoft.Office.Interop.Excel;
from there to run a macro it is basicaly just the knowlege of Excel objects
and not much of c#.
|
|
|
|
|
Thank you
You are probably right what I need is know how to call an excel procedure from an external program
Regards
|
|
|
|