|
Good questions. Unspecified is what it will most likely be when you parse. But you can also use the SpecifyKind method.
<br />
DateTime dt = DateTime.SpecifyKind(DateTime.Parse("some string"), DateTimeKind.Local)<br />
Comparison is a tricky one as well. DateTime has an Int64 buried underneath it that represents the ticks that identify the time. There were two bits left over of the 64 that were not used, so in .Net 2.0 they decided to use them for the DateTimeKind enum. I imagine an equals should check the kind since it will probably just compare the two integers. Compare might do this as well. MSDN just tells you to make sure they're both in the same time zone.
www.logifusion.com
|
|
|
|
|
Out of curiosity, it it capable of being set to an arbitary timezone, or just local/utc?
|
|
|
|
|
Unfortunately not. They only had two bits left over, so they used it to decide if it was local, universal, or unknown. You could use a TimeZone object to convert a DateTime to its local time. But then you just have to obtain a TimeZone object for the time zone you want. When you use TimeZone.ToLocalTime() it will mark it as local. It can be pretty confusing to work in more than one time zone. I usually stick to universal time.
www.logifusion.com
|
|
|
|
|
is TimeZone one of the new .net2.0 classes? Having had to deal with different zones in 1.1 I ended up with a class that only did local and utc since the system made them somewhat bearable, but not being able to do arbitary zones really bugged me.
|
|
|
|
|
It's not a new class. The problem is it's abstract and there isn't an easy way to just grab another time zone.
www.logifusion.com
|
|
|
|
|
Hi everybody,
I tried the following code, but I still need to click on the cell before it is selected. Is there a way to make the a cell the selected...
dataGridView.CurrentCell = dataGridView.Rows[e.RowIndex].Cells[pathIndex];
|
|
|
|
|
An unhandled exception of type 'System.NullReferenceException' occurred in nbass.dll
Additional information: Object reference not set to an instance of an object.
--------------------------
i just want to record the voic from the mic and play it back
|
|
|
|
|
|
Sounds like you have disposed of an object whilst still being used by a class.
Try to run an debugger on it to see what the class is, and from there you can try to find where you dispose the instance.
|
|
|
|
|
Is it possible to declare namespace and class properties in a custom control? I have a control that loads a dropdownlist which referances a classlibrary that in-turn calls a stored procedure (DataLayer). I would like to make this control dynamic so that I can load differant data into the dropdownlist by setting the properties of the control for the namespace, class and method which will retrieve the data and return a dataset to the control to load the dropdownlist.
I.E.
DataSet ds = New DataSet();
CCNameSpaceProperty.CCClassProperty DataLayerRef = CCNameSpaceProperty.CCClassProperty();
ds = DataLayerRef.CCMethodProperty(ds);
Paul Dietz
|
|
|
|
|
Would a better solution be to pass the dataset as a property into the control to load the dropdownlist?
|
|
|
|
|
hi all
i want to place a search button which searches employee details when i give the employee name in the search text box.I am using Grid view for displaying employee details.
please help me to get search button.
thanks in advance
cheers
sangeet
|
|
|
|
|
1: add a field and a button + eventhandler
in the eventhandler do the following:
2: get the data (employee name) out of the field
3: create a sql statement and pass it to the database
4: bind the dataset to the grid
hope this helps
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
Create a button named i.e SearchButton and a textfield for holding the employee name.
Create a button_click event handler much like below:
<code>
private void SearchButton_Click(object sender, System.EventArgs e)
{
//Retrieve the name of the employee to search for
string name = this.textBoxName.Text;
//Searchstatement, much like SQL. I.e search for "Name like 'sangeet'".
//You can also add wildcards '%' to catch different versions of your
//searchtext. I.e 'searchstring = 'ColumnNameHere like '%" + name + "%'";
string searchStatement = "Name like '" + name + "'";
//Sort your hits, descending or ascending
string sorting = "Name DESC";
//Search for a row with matching name in column 'Name'
DataRow []rows = this.ds.Tables["TableNameHere"].Select(searchStatement, sorting);
foreach(DataRow row in rows)
{
for(int i=0; i < row.ItemArray.Length; i++)
{
//Do something with the data in each column of your datarow
Console.WriteLine(row.ItemArray[i].ToString());
}
}
}
</code>
-Larantz-
-- modified at 15:00 Friday 28th April, 2006
|
|
|
|
|
Hi all,
Could anyone recommend a good article on how to design ADO.Net in an OOP design in C#? I'm having trouble understanding the subject, as although it's easy to drop data adapters and binders on to a form, this strikes me as being much akin to traditional VB 6 methods of handling data access, and putting lots of logic in the form itself.
Cheers,
Martin.
|
|
|
|
|
Create a DAL component (Data Access Layer).
Implement methods like ExecuteSelect, ExecuteInsert and stuff like that .
this component should handle the connections and other objects .
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
or use Microsoft Enterprise Library's Data Access Block
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Hi all!
I am coding an application, which will allow the user to pick a font for their text, in an MS Word fashion (A combobox in the toolstrip). I have managed to create the ToolStripComboBox and populate it with the fonts, but I also want the items in the combobox show their respective fonts, eg Arial would be written in the font Arial.
I think that you must do some custom painting for what I want, but how? If I override the Paint() function it draws everything under the combobox. If anyone could provide me with an example/point me in the right direction I would be grateful!
- Martin
-- modified at 5:49 Friday 28th April, 2006
|
|
|
|
|
|
That's in VB and I'm using C#, could you point me to something which is written in C#?
|
|
|
|
|
Read here about ComboBox using.
Best regards, Alexey.
|
|
|
|
|
|
Look here.
Enjoy !
Best regards, Alexey.
|
|
|
|
|
Hmm... The problem is that that is a regular ComboBox, and mine is a ToolStripComboBox, I think that's the problem. Because when I try to override the DrawItem method it says 'No suitable method found to override', even though I have defined my own.
|
|
|
|
|
There doesn't seem to exist a DrawItem event in a ToolStripComboBox. That means that there is no way to do what I want to.
|
|
|
|