|
Hi all !
I am using C1FlexGrid to contain the data that have gotten from database. Some data have date type So I want to order them. I cant't seem control. Help me !
|
|
|
|
|
I have data coming in on the RS232 line that is terminated with a <CR><LF> sequence. Is there way using the MSComm Control to have it not read the buffer until it has the entire line?
I have tried the following but it still doesn't get the entire line all the time:
While MSComm1.InBufferCount = 0
Wend
strResponse = MSComm1.Input
This was more easily done using the old-style INPUT LINE command:
OPEN "COM1:9600,N,8,1,LF" FOR RANDOM As #1
LINE INPUT #1, strResponse
CLOSE #1
Is there a way to have the MSComm control behave in this way?
Thanks,
Tim
|
|
|
|
|
Hello,
I am fairly new to vb.net programming and I am trying to figure out how to calculate the number of days between 2 dates. I have some Idea i.e. convert each date to a julian date and then subtract the 2 and wala! Are there date functions in .net that will convert a date to julian dates automatically?
Thanks in advance
|
|
|
|
|
You don't need to do any conversion. Look up the DateDiff function.
Robert
|
|
|
|
|
It worked like a champ!
Thanks,
Tom.
|
|
|
|
|
if u are on here, and a visual basic 6.0 pro then can u email me quickly on leeansell@btinternet.com
Cheers
Lee Ansell
|
|
|
|
|
Anonymous wrote:
if u are on here
If I'm reading this, where else would I be ?
Anonymous wrote:
and a visual basic 6.0 pro then can u email me quickly on leeansell@btinternet.com
Lee, you have two options. Personally, I consider VB6 beneath me, but if you want help on this sort of level, expect to pay for it, perhaps rentacoder is a good place to start. On the other hand, if you're willing to come back here and check for answers, and to ask specific questions as an active participant in this forum, I'm sure there are plenty of people willing to help you. Saying 'if you know VB6, email me' is just plain rude. Why would anyone do that, if you're not even willing to state your question, or to check here for responses ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi to you all,
as in subject, i'm trying to find dates as "first tuesday of the month" or "last monday every two months" how can i do it in vb.net
i found something in vb6 but can't find equivalents in vb.net
thanks in advance!
Fule2Run
|
|
|
|
|
The datetime class has a 'DayOfWeek' property, which makes what you want to do a snap. Set your date to the first of the month, check the day, and then step forward to the right date from there. Last Monday is same, just work backwards.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i'll try,
thank you!
Fuel2Run
|
|
|
|
|
Hey
I was wondering if anybody knows or can point me in a direction of where i need to go. I'm trying to write a vb .net app to replace our current server Manager program. This lists all available servers on our Domain. The problem that i'm running into is Showing currently used Shared files, username and if it's locked or not. I used WMI to list all available shares on the server. If anybody could point me in the direction needed, or has an example, it'd be very greatly appreciated.
Thanks
Gerry
|
|
|
|
|
I'm having problem on the following code:
Public Class ExpenseEntity
Public Function saveNewExpense(ByVal tempName As String, _
ByVal tempType As String, _
ByVal tempAmt As Integer, ByVal tempCatID As Integer)
Dim cnNewEx As SqlCeConnection = New SqlCeConnection( _
"Data Source=\My Documents\PFMS.sdf; password=9EbK63Lj")
Dim SQLNewEx As String
Dim cmdSQLEx As SqlCeCommand
Dim getEName As SqlCeDataReader
Dim tempID As Integer
SQLNewEx = "INSERT INTO ExpenseDetail(expenseID, catID, eType, eAmount) " & _
"VALUES (" + tempID + ", " + tempCatID + ", '" + tempType + "', " + tempAmt + ")"
cmdSQLEx = New SqlCeCommand(SQLNewEx, cnNewEx)
cmdSQLEx.CommandType = CommandType.Text
cmdSQLEx.ExecuteNonQuery()
cmdSQLEx.Dispose()
cnNewEx.Close()
I receive the error as: "An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
Additional information: InvalidCastException"
Please help... thanks in advance
|
|
|
|
|
Lot of code here. which line has the exception, or didn't you bother to step through in the debugger ?
I'd imagine that when you set SQLNewEx, that one of the objects you're passing in does not convert to string by itself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your reply....
Some how I get to manage solve the error through out the night. The exception is occur at the last SQL statement.
|
|
|
|
|
yes, that's where I said. That means sometimes the variables you're passing through are either null, or some type that can't be converted to string. You need to write some code to protect against bad values, and insert an appropriate value into your SQL.
Doing it as a stored procedure would be even better. It seems mostly in VB land that people ignore this basic design step.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Add .ToString() to your integer types. For example, instead of tempID use tempID.ToString() .
|
|
|
|
|
Thanks for your reply....
Some how I get to manage solve the error through out the night. The problem solve when replace '+' with '&' in SQL statement.
|
|
|
|
|
That works by itself, actually
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You should say in the end to datagrid to bind itself.
DataGrid1.DataBind()
|
|
|
|
|
howdy,
I'm having trouble adding a new row to my primary table.
I have a bunch of comboboxes bound to lookup tables and a tertiary binding for each binding selectedValue to the main datarow.
When I try to change the values, and save, the last comboBox fails to change the lookup ID in the primary table, and remains -1, the initialization value.
any ideas?
[snip]
Me.UcInspect1.ucicmbCLLI.DataSource = Me.dvClli<br />
Me.UcInspect1.ucicmbCLLI.DisplayMember = "CLLIName"<br />
Me.UcInspect1.ucicmbCLLI.ValueMember = "CLLIId"<br />
Me.UcInspect1.ucicmbCLLI.DataBindings.Add(New Binding("SelectedValue", Me.dvInsp, "ClliID"))
[snip]
Private Sub newInsp(ByVal sender As Object, ByVal e As System.EventArgs)<br />
Me.dvPlant.RowFilter = "InspNumber = '-1'"<br />
Dim dr As clDatalayer.dsInspData.InvRow<br />
dr = Me.dsData.Investigation.NewRow<br />
With dr<br />
.InspNumber = 0<br />
.CoID = 3<br />
.InvTypeID = 1<br />
.ReasonsID = 1<br />
.InvID = 123<br />
.ExchID = -1<br />
.ClliID = -1<br />
.StatusID = 1<br />
End With<br />
Me.dsData.Investigation.Rows.Add(dr)<br />
Me.BindingContext(Me.dvInsp).EndCurrentEdit()<br />
Me.BindingContext(dvInsp).Position = Me.BindingContext(dvInsp).Count - 1<br />
<br />
End Sub<br />
[snip]
Set the Values in the UI...
At this point all values have changed excapt CLLIID which is still '-1', even though I've selected a CLLI, and the combobox.selectedvalue <> -1. very strange.
[snip]
Private Sub SaveInsp(ByVal sender As Object, ByVal e As System.EventArgs)<br />
Me.BindingContext(Me.dvInsp).EndCurrentEdit()<br />
Dim i As Integer = Me.BindingContext(Me.dvInsp).Position<br />
Me.BindingContext(Me.dvInsp).Position = 0<br />
Me.BindingContext(Me.dvInsp).Position = (i)<br />
Try<br />
Me.procData.setData = Me.dsData 'runs datalayer update<br />
Me.BindingContext(Me.dvInsp).Position = i<br />
MsgBox("Changes Saved")<br />
Catch ex As Exception<br />
MsgBox(ex.Message)<br />
End Try<br />
End Sub<br />
let me know if you have any ideas...It just seems like that last combo isn't committing it's changes.
TIA
Jeremy
Thank you, Thank you, I'll be here all week...
|
|
|
|
|
Hi,
I have a litle problem and I wonder if someone could help me to start while creating MS Word output from VB.
I have to create output (.doc file) which will contain text, pictures, tables, etc.
Examples, references on web pages, .pdf files, web tutorials, e-books, will do.
Deeply Thnx!
Zlatko Stapić
|
|
|
|
|
Microsoft Word uses it's own document architecture. VB provides no support for creating output in the correct Word format.
You need to add a reference to the Word object library to your VB project, then use the Word COM interface to manipulate documents programmatically. The MSDN contains tons of reference materials on using the Word object library functions.
Robert
|
|
|
|
|
Thanks for your reply...
I found lots of materials in MSDN, and solve almost all my problems. One thing is waiting, and that is how to save a created document, but without any
"save as" dialog boxes. But, I thing I'll manage that too.
Thanks Again...
|
|
|
|
|
Thanks for your reply...
I have done some digging in MSDN, and as you said, I found almost everithing I need. Actualy I solved all my problems, except one, and that is how to save a created word document without any "save as" dialogs. But I think I'll manage that too...
Thanks again....
|
|
|
|
|