|
|
Hi,
I have a datagridview, and it's column(3) contains datetime field from datatable, selected from SQL-Query.
I want to set the culture info as "en-GB" to that date field.
is it possible? I tried by
dim dtbf_52 as new datatable, secidexp As New DataGridViewTextBoxColumn
ci = New System.Globalization.CultureInfo("en-GB")
dtbf_52.Locale = ci
Mydatagrid1.DataSource = dsf_52.Tables(0).DefaultView
With secidexp
.MaxInputLength = 10
.DataPropertyName = "sec_id_expiry"
.HeaderText = "ID EXPIRY DATE"
End With
but it's not getting the dd/MM/yyyy format for date field. So, How To set the culture info to this field?
Thanks Again
|
|
|
|
|
I don't know if this is of any help in your situation, but I have just been reading the MSDN documentation for DateTime again, for something of my own. Anyway, are you aware that the DateTime structure now has a Kind property (DateTimeKind enumeration) which can force it to LocalTime, amongst others.
I haven't finished reading all of it yet, but perhaps you might want to have a look for yourself.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi can anybody give me the vb.net code to send the aspx page content to a particular email id on submit
thanks
giri
|
|
|
|
|
|
you found the right forum, although you shouted there, so why cross post ?
We tend to give more help to people who show signs of trying to help themselves.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hello,
I'd like to know if there is an easy way to subtract two times, e.g:
HH:MM:SS,DDD
00:00:53,040
00:00:48,600
____________ -
??:??:??,???
I am now splitting the times (.split(":") ), putting the values back together as one decimal number, subtracting, and placing the ":"'s back (which is the hardest part). Now there must be an easier way to do this, but I don't know how. Somebody please help me out on this one?
Thanks in advance,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
DateTime, Parse, Subtract
|
|
|
|
|
Use the time span class TimeSpan instead of DateTime
Natza Mitzi
|
|
|
|
|
Natza Mitzi wrote: Use the time span class TimeSpan instead of DateTime
And how exactly would that help the OP where Lucs answer wouldn't?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Not true. You still have to use the DateTime class and the RESULT of the Subtract would be a TimeSpan.
|
|
|
|
|
Yes, that's true. Thanks all for your reply, I will try this tomorrow. Always nice to know that there are people willing to help you out!
Motivation is the key to software development.
|
|
|
|
|
Whenever calculating time I like to see it as a time span and not a date, I find it cleaner logically and its a safer when negative values might be present (they always come when you least expect it). When using a TimeSpan you convert twice and test for negative values once...
Natza Mitzi
|
|
|
|
|
when i tried using a few api functions like FindWindow
they didn't work for me
no error was produced in the debug mode(ie i ran using F5)
how is that??
is there a new way to use api in vb 2008
cause in older vb it is working??
TheMrProgrammer
|
|
|
|
|
Ya, using api in .net is different from VB 6.0. In VB 6.0 we often uses api call but in .net. Here is an example,
<DllImport("KERNEL32.DLL", EntryPoint:="GetSystemDirectoryW", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Function GetSystemDirectory(ByVal Buffer _
As StringBuilder, ByVal Size As Integer) As Long
' Leave function empty - DLLImport attribute
' forces calls to GetSystemDirectory to
' be forwarded to GetSystemDirectory in KERNEL32.DLL
End Function
Please use google for futher clarification.
|
|
|
|
|
The process is known as PInvoke or P/Invoke.
If you search MSDN, or Google on those terms you will get lots of examples.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
The program I am writing now needs to send data through the serial port automatically. So far, I have been able to put it into a queue list and send it out using a timer. The problem is, the data sent is in two parts and must come consecutively after each part. After that, the timer kicks in and send another two part data.
Does anyone have any ideas on how to do it?
|
|
|
|
|
Your description isn't very clear. How to do what?? Send the data? It sounds like you already have that part down. Use a Timer? Look into System.Threading.Timer[^].
|
|
|
|
|
Hmmmm, the main idea is to queue a list of test to send through the serialport. I have got it down with a timer and queue list. The problem is the test themselves. Each test has a function that calls the device connected to the serial port. However, the functions itself is in two parts. I need to send it one after the other.
For example, (Test 1,2,3,etc) -> queue them -> send through serialport.
But each test, e.g Test 1 - function "a" and function "b" needs to be sent consecutively.
Anyh ideas on how to work around it? I tried putting it into an array and sending it out as an array but the device can't process the information fast enough. I need at least a 2sec delay.
|
|
|
|
|
I don't know how you designed the code, the quick'n'dirty method to pacing something like this at a 2 second interval would be Thread.Sleep(2000).
Normally, I'd probably build a component that handles it's own queue and keeps not only the message that should be sent, but with it, a delay time for how long until the item should be sent. Pop the item off the queue, check it's delay time and setup a Threading.Timer with the delay value and return. The Timer callback will call your code that sends the data to the device.
|
|
|
|
|
That sounds like a good idea. I'll give it a go and see if it works with it. Thanks a lot
|
|
|
|
|
Right, tested this out but I have a problem of with the string "DataSend". Every time it checks for the the varible that I want, it just repeats itself. For example, I queued the test according to "c", "a", and then "c" again. So the queue sends out "c", "a",and lastly "c". The first time it runs, works perfectly. When the timer tick even kicks in, and sends out the next variable "a", I checked it for "a" and it goes well. After that, I checked for the third variable "c", it skips that and goes straight to "a" instead. What happened here? I don't really understand why it refuses to move forward.
Timer1 tick event
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If tasklist.Count > 0 Then
'Run the next test
DataSend = tasklist.Dequeue()
ListBox1.Items.RemoveAt(0)
serialPort.Write(DataSend)
If DataSend.Contains("c") = True Then
Timer2.Enabled = True
Timer1.Enabled = False
ElseIf DataSend.Contains("b") = True Then
serialPort.Write(DataSend)
Timer1.Enabled = True
Timer2.Enabled = False
ElseIf DataSend.Contains("a") = True Then
serialPort.Write(DataSend)
Timer1.Enabled = True
Timer2.Enabled = False
End If
Else
serialPort.Close()
PortStatus.Text = serialPort.PortName & " disconnected."
Disconnect.Enabled = False
Connect.Enabled = True
Timer1.Enabled = False
Timer2.Enabled = False
MsgBox("Finished All Test")
End If
End Sub
Timer 2 tick event, just an event to extend the time for variable "c"
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
serialPort.Write("p" & vbCrLf)
Timer2.Enabled = False
Timer1.Enabled = True
End Sub
I tried making the string empty before dequeue but it doesn't work. Any ideas on how to work around this?
|
|
|
|
|
This might be a possible bug in vs2005 (I know there is a 2008 but have to use 2005 for this one), I did do a search in google but couldn't find an explanation.
I have a usercontrol that's very simple, it just holds a state (and adjusts its text value).
When I place this usercontrol on a form, from time to time I get build errors.
It's easy to fix but very annoying.
Fix = go into designer off the form and delete the project namespace
so: the control is declared like: projectname.usercontrolname
when I delete the projectname. it builds fine and works fine.
Anyone know if this is a bug or how I can fix this, it's really getting on my nervs.
Thanks in advance
|
|
|
|
|
For what it is worth, I have had a similar problem in VS 2003 with datasets.
I would get a build error, and then I would find that the studio had "very helpfully" corrected the generated code.
I would "decorrect" it, and it would work fine, until the next time I built the project.
Finally I just started an entirely new solution / project, recreated all controls, etc, and copied all my own code. No problems after that.
I guess it depends on how badly it gets on your nerves, if it is worth the trouble.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Johan Hakkesteegt wrote: Finally I just started an entirely new solution / project, recreated all controls, etc, and copied all my own code. No problems after that.
Tried that to but didn't help me
I did find that it only happens when I have the form open in design mode, so my fix at the moment is making sure I don't have any of the forms open in design mode when building
|
|
|
|