|
Ejaz
Defining mDeliveryDate as Date means it is stored in the system date format, not a string.
The format is done later.
DateTime.TryParse(txtdate.text, mDeliveryDate )<br />
Dim longDate As String = mDeliveryDate.ToString("dd-MMM-yyyy")
will give you "01-Jan-2008" in longDate. If it is an invalid date it will give you DateTime.MinValue (01-Jan-0001)
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks Bob I will try this.
|
|
|
|
|
i am using dotnet2005.i do my project in vb.net windows application.
i want to display amount as 12,34,567.00 in crystal report.
in my project,amount is displayed as 1,234,567.00 in crystal report.
displayed as 1,234,567.00 is wrong,displayed as 12,34,567.00 is correct.
so how to displayed as 12,34,567.00 in crystal report.
there is any options in crystalreport to displayed as 12,34,567.00.
no option means,can solve this problem using vb.net code.
|
|
|
|
|
First - this is a CR problem and so no VB-code will help you.
But you can provide format options for your fields in CR - try looking there (I think there might be a way).
If not you can create a formula-field in CR (it provides a own CR and even a Basic syntax) and format a number just like you would do it in plain VB.
If you don't manage this your last option is to use a character-field for the number and format it in VB before sending the data to the crystal report.
|
|
|
|
|
It looks like you want to format it for Indian currency.
I havn't looked into CR but I know VB does it automatically once you set the Culture setting.
|
|
|
|
|
i am using dotnet2005.i do my project in vb.net windows application.i want to add one year from selected date.the following code is
Private Sub FromDateTimePicker_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FromDateTimePicker.ValueChanged
ToDateTimePicker.Value = FromDateTimePicker.Value.AddYears(1).AddDays(-1)
End Sub
The above code is used to display as follow
for (ex)
using above code,if click date as 01/04/2008 in FromDateTimePicker means,then automatically displayed as 31/03/2009 in ToDateTimePicker.like this,if i click any date means,correctly worked.but if l click 29/02/2008 in FromDateTimePicker means,it must be automatically display as 27/02/2009 in ToDateTimePicker.But i want to display as 28/02/2009 in ToDateTimePicker.so in leap year above code is not working.how to solve this?
|
|
|
|
|
Use this condition to check whether the year is leap or not
If (DateTimePicker1.Value.Year Mod 4 =0) Then<br />
Else<br />
EndIf<br />
|
|
|
|
|
Note: That is not the complete condition to check for leap years, it only works for years close to now.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
add some code conditional on DateTime.IsLeapYear
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Just subtract the day before you add the year:
ToDateTimePicker.Value = FromDateTimePicker.Value.AddDays(-1).AddYears(1)
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi to all
In my gatagrid i populate the values from my one table with two fields
Now on edit dynamically i want to show the dropdown list with data in that cell
should come into that dropdown. and it should be get updated
how to do this i'll be very much thankful to you.
|
|
|
|
|
In you are using 2005
In your datagridview choose edit columns, and change the type of column of the column you want to be a dropdown from datagridviewtextboxccolumn to datagridviewcombobox column and then you can bind the dropdown to any datasource
Alexei Rodriguez
|
|
|
|
|
where should i go then? please help me out
|
|
|
|
|
hi
What is Wrong with you, are you crazy, this is not a chat room, Stop posting junk, what is your problem, lets see if we can help, explain
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
|
Hi,
I have this code that gives me an object reference not set to an instance object for variable objDI
when the code hits
outputfile = gserver.Outfolder & "\" & objDI.outputfolder
This is weird because the PDFDocs count is 1.
Please help.
<code>
For Each objDI In objSI.PDFDocs
outputFile = gServDef.OutFolder & "\" & objDI.OutputFile
If objDI.DocType = "HTM" Then
If Not PrintHTM(objDI.InputFile, outputFile, objSI.ToString) Then
LogPrintError(objSI, file)
Return False
End If
Else
If Not PrintOther(gServDef.InFolder & "\" & objDI.InputFile, outputFile, objSI.ToString) Then
LogPrintError(objSI, file)
Return False
End If
End If
Next
<\code>
|
|
|
|
|
You failed to specify what type of object objDI is, therefore you will not have access to its properties. If you add As PDFDoc after For Each objDI , or whatever type of object collection you are enumerating, this should work as you expect.
Clean code is the key to happiness.
|
|
|
|
|
I had actually declared the variable objDI at the top of the function
whch I did not include in the code snippet.
But I will try your idea anyway.
|
|
|
|
|
Hello everyone, I need help with some options.
I am creating a test app more as a proof of concept type deal. In the end, this project is likly going to moved to asp but thats later. Right now I have a set of classes that create themselves from a database. The program has to take the objects and put them into seperate groups, then compare them. Once an object is done, it is removed from the group.
This works fine when I am just comparing two objects, but I am stuck when it comes to finding a way to throw them into two or more groups, and compare each item in turn. At first I thought an array or linked list would work, but I am not sure what the performance would be when each array has over one hundred objects.
Is this the way to go, or is this a good time to break the books open and go through collection?
|
|
|
|
|
a few hundred objects in a List or Array won't bother any CPU
If we are talking about several millions ...
If you want some high performant code then you will have to look hard at the problem.
For example if you want to sort a bunch of objects into groups there are two major approaches:
1.) you talke object by object, try finding out the right group and then put the object in the right bucket - for this approach nothing is wrong with List (if you are using .net 3.5 try the HashSet if not the Dictionary might be the most performant - access like)
2.) You start by putting all objects in one group and then going through and splitting if necessary - this is commonly solved with an additional object-field (just a number indicating the group).
As a example for this option: maybe you did some compiler-theory course (or read the dragonbook). Anyway you might know a situation where you are working with finite-state machines (WF anyone - sometimes you are wondereing if there is a way to get the FSM "smaller" (i.e. fewer states - same results) - this can be done by an algorithm that first puts all states in one group and then uses some sophisticated test to split those groups - as a result you get a collection of groups you can transform into a new FSM with the same resluts....
You see: for the second approach you will have to know your problem very well!
|
|
|
|
|
Thanks CKnig
Getting them into the right group isn't a problem, that comes straght through the DB. I was just worried about itterating the bunch multiple times.
Now I have to break the books out and look into the Hashes and Dictionary.
Linked lists are looking good if those don't work. I will have to do a lot of removals in the middle, but not alot of searching so that won't slow it down.
|
|
|
|
|
Hi all
I'm currently working on a fairly large project with multiple developers. Throughout the application we'll be using a bunch of images for icons, buttons, etc and I'd like to be able to set up some sort of central repository for them all.
I guess ultimately I'd like to have them set up with enumerations and not have to keep the image files in one specific place e.g.
label1.image = ourImages.thePictureOfACat
I was thinking about using one big imagelist but that would restrict us to a certain size for all the images. I haven't had any luck with sharing resouce files between projects either. We use SourceSafe if that helps at all...
Any ideas?
Thanks
|
|
|
|
|
Perhaps not the most elegant way to do this, but it might work for you (we are using a similar solution for language choices in an app): establish a table in a database somewhere with a field for the type or function of your image, and another field with the path to the repository including the actual image name. Create a driver that retrieves the image based on the requested function from the path mentioned in your table. That way your example would look something like this: label1.image = ImageFetcher.GetImage("Cat") (or something like that). The driver is easy to create and make available to your colleagues.
Ofcourse this solution as I suggested it here is only any good during the development of your app. However I am sure you can adapt the idea to use (for example) an xml file, which can easily be included with the app once it is ready, instead of a database table. And obviously you'll have to consider how to include the actual images, if you don't just want to dump them in a folder during installation.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi to all
My grid is showing the data. in grid there is edit
when i click on edit dropdown should be created insted of
textbox. would u know how to achive this....
|
|
|
|
|
Hi!!
In CellClick Event of the DataGrid write the below code
If e.ColumnIndex = DataGridView1.Columns("ColEdit").Index Then
Dim dgvCombo As New DataGridViewComboBoxCell
DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex) = dgvCombo
End If
|
|
|
|