|
my application create a folder on daily basis with name as today.tolongstring (eg Monday, July 07, 2008). so how can i get on the name of yestertay folder (sunday, July 06, 2008)
if today is first day of the must how can i get yesterday value
|
|
|
|
|
How about this?
DateAdd(DateInterval.Day, -1, Today.Date).ToLongDateString
--------------------------------------------------------
Knowledge is knowing that the tomato is a fruit.
Wisdom is not putting it in fruit salad!!
|
|
|
|
|
thanks. how do i get the last day of the month in the same format
|
|
|
|
|
datetadd(day,-1,today)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how can i get the last and first day in a month in the format i have
i have Dim fd As New DateTime(DateTime.Now.Year, DateTime.Now.Month, 1)
fd.ToLongTimeString()
7/1/2008
MsgBox(fd)
|
|
|
|
|
What are you bone lazy our just thick . You have been given some samples, hints and if you read some of the other answers here there is plenty of examples of date manipulation.
If you cannot work out how to get the information you need with start you have been given then give up being a programmer - you are not going to make it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Don't call Now repeatedly. If you are unlucky (i.e. use it often enough) it will give you the wrong result, as the value may change from one call to the next.
To get the last day of the month you just add one month and subtract one day.
Dim n As DateTime = DateTime.Today
Dim first As New DateTime(n.Year, n.Month, 1)
Dim last As DateTime = first.AddMonths(1).AddDays(-1)
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Bloody hell, I've been working with the datetime object for ages and didn't know about the add***** methods. This is the other reason I lurk here.
Thanks Guffa have 5
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
thanks Guffa. mycroft holmes that been lashin has ofcourse learn from my 'lazi'. i did not phrase the probem well. i need to be able to put all folders created by my application at the end of a month in a single folder( that is first day of july,sum for june). i have been able to get the logic like is
'Dim fd As New DateTime(DateTime.Now.Year, DateTime.Now.Month, 1)
'lastday = DateAdd(DateInterval.Month, 0, fd).ToLongDateString
'If Today.ToLongDateString.Equals(lastday) Then
the move here
endif
thanks once more for your advice
|
|
|
|
|
So, what you really want is that at the beginning of a new month, you want to move all the folders of the previous month?
Something like:
Dim today As DateTime = DateTime.Today
If today.Day = 1 Then
Dim t As DateTime = today.AddMonths(-1)
While t < today
Dim folder As String = t.ToLongDateString
If Directory.Exists(folder)
' move it
End If
t = t.AddDays(1)
End While
End If
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
I dont see any value property for button. When I convert VB6 application to VB.net, the code as follows
VB 6.0
Public Property Get VarArray(ByVal ctrl As Control) As String
VarArray = ctrl.Value
End Property
After converting to VB.NET
Public ReadOnly Property VarArray(ByVal ctrl As System.Windows.Forms.Control) As String
Get
'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Value. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
VarArray = ctrl.Value
End Get
End Property
Here VB.NET code is giving compilation error "Value is not member of 'System.Windows.Forms.Control'"
Please let me know how to do this.
Thanks in Advance,
AR Reddy
|
|
|
|
|
You could consider going through the trouble of inheriting System.Windows.Forms.Button to create your own button control that has a Value property, but that process, although not particularly difficult, may still not be necessary. Maybe you can simply manipulate the button's Tag property in .Net to emulate how you were using the Value property?
|
|
|
|
|
A couple things:
First, the property Value on a CommandButton in VB6 is a Boolean - not a string.
Secondly, In all of VB6's infinite wisdom, doing Call Command1_Click() has the same effect of setting Command1.Value=True in code. So, the only time VarArray in your VB6 code above would be true is when Command1_Click() is called.
If you are using RadioButtons or CheckBoxes, Value was replaced by Checked .
|
|
|
|
|
how can i retrieve end of day and end of month
|
|
|
|
|
Get the 1st day of the next month and dateadd -1
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how do i get the 1stday of the nextmonth
|
|
|
|
|
Add a month to the 1st day of this month.
Looking at your questions, I'd suggest getting the big reference manual called Google working for you - or give up programming as you don't seem to have any concept of researching 'problems'
Bob
Ashfield Consultants Ltd
|
|
|
|
|
thanks for your ctriticism. it have be useful
|
|
|
|
|
It was meant to be helpful.
If you are serious about becoming a programmer you need to be able to research problems yourself, rather than just posting questions to forums. Your questions about date manipulation are very basic and easily answered by looking at the Visual Studio help, or just typing into Google. What will you do if you have a production problem in the middle of the night, when an answer is needed asap? Post a question here and wait for possibly several hours for an answer or use BOL and Google and think for yourself?
As an ex Development Manager, prior to a face to face interview I would ask what forums a candidate was a member of, and their user name. I then checked on their postings. If I saw loads of simple questions and no serous replies I would not waste my time interviewing them.
That was my point, so your sarcasm was not appreciated.
BTW, your profile says you are in the USA so why ask
Ebube wrote: can someone tell which institute offer quality training in mobile application using vb 2008 in india
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Probably going home - dev manager found out his moniker
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi, im using VS2008 n working on windows appication,
here i have a problem, is it possible for me to draw a bitmap by pixel,
for example if i have 2x2 pixel bitmap, how can i set its color each pixel with different color? for example yellow,green,red and black..
please help me... give me any guide or the best reference for me to solve this..
|
|
|
|
|
Use the SetPixel method of the Bitmap class.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
ok, i have use the setpixel to draw one pixel now, but how about the next pixel, it will be replacing the color that have been draw before,
here my sample code for button click event:
Dim bmp As New Bitmap(PictureBox3.Width, PictureBox3.Height)
Dim gr As Graphics = Graphics.FromImage(bmp)
Dim A As Color
Dim i, j As Integer
i = 0
j = 0
Dim n As Integer
For n = 0 To ListBox1.Items.Count - 1
If ListBox1.Items(n) = "A" Then
A = Color.Orange
ElseIf ListBox1.Items(n) = "R" Then
A = Color.Red
ElseIf ListBox1.Items(n) = "G" Then
A = Color.Lime
Else
A = Color.Black
End If
bmp = New Bitmap(100, 100, gr)
bmp.SetPixel(i, j, A)
i = i + 1
j = j + 1
'gr.DrawImage(bmp, 10, 10)
Next
bmp.Save("C:\bmp.bmp")
how can i store the drawing untill it complete all process and then show them..
|
|
|
|
|
You are creating a new Bitmap object for every iteration in the loop, throwing away the previous bitmap, so only the last pixel will be present in the last bitmap. You should create only one Bitmap object.
And remember to Dispose all the Bitmap and Graphics objects that you create when you are done with them.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
In addition to the response you got, if you have a big bitmap, you should read my image processing articles for more efficient ways to set a LOT of pixels.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|