|
hi,
i think you want to show Time in hour or Half hour format.
Change CustomFormat property to "hh 00" or "hh 30" according to conditon
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Can the date time picker do both date and time at the same time?
|
|
|
|
|
yes. you can .
use following for get date and time
msgbox DateTimePicker1.Value.ToString
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Hii
Thanks now i got the shapes present on the panel at runtime .
1 ) Now , the problem is , i am having some normal controls like Textbox,Rb,CBox,Checkbox,Grid ..which are generating at runtime on the panel(Runtime generated ).Now if if move the RectangleShape ,OValShape on those controls ( Textbox,Rb,CBox,Checkbox,DataGridview ..) Dark Lines scattering all over the control are appearing while Dragging from one place to another place (For this i used pickbox from codeproject for shapes ) on the panel .I have refresh my panel again .THis makes the Shape controls Flickering all the time .
2 ) If i create a control .like Textbox,Rb,CBox,Checkbox,Grid on the location of Shape control ,The boundaries of shape controls are appearing on the Control which is not good for looking . I want like at Visual Studio 2005 Design time .It has to go back of the control and doesnt show the boundaries of shapecontrol on normal control .
3) Its not in the smooth way like in Visual studio 2005 design time
Thanks ,
|
|
|
|
|
VB 8.0 wrote: 1 ) Now , the problem is , i am having some normal controls like Textbox,Rb,CBox,Checkbox,Grid ..which are generating at runtime on the panel(Runtime generated ).Now if if move the RectangleShape ,OValShape on those controls ( Textbox,Rb,CBox,Checkbox,DataGridview ..) Dark Lines scattering all over the control are appearing while Dragging from one place to another place (For this i used pickbox from codeproject for shapes ) on the panel .I have refresh my panel again .THis makes the Shape controls Flickering all the time
Yes. This is because you're not redrawing the controls that you're dragging the line over. Until those controls are redrawn, they'll look like garbage. The problem with doing this is that you will be redrawing a lot more stuff for each MouseMove event you get. This can cause even more flickering than you're dealing with now.
VB 8.0 wrote: 2 ) If i create a control .like Textbox,Rb,CBox,Checkbox,Grid on the location of Shape control ,The boundaries of shape controls are appearing on the Control which is not good for looking . I want like at Visual Studio 2005 Design time .It has to go back of the control and doesnt show the boundaries of shapecontrol on normal control .
I have no idea what you're talking about with this one. I'm guessing that you'll have to redraw the entire panel control, along with all of it's child controls again once the new control is added.
VB 8.0 wrote: 3) Its not in the smooth way like in Visual studio 2005 design time
Google for "Host Visual Studio Forms Designer". You may be surprised at what it takes to do what you want.
|
|
|
|
|
THanks ,
i used BringToFront ,SendToBack then it is working properly .
|
|
|
|
|
Hello everyone,
I need to draw a racetrack map using GPS data. Please kindly help or tell me where i can get help from?
Thanks a lot!
Much appreciated
Amar
|
|
|
|
|
Sounds like you need a lot of help. Why do you need to do this ? Have you accepted a job and now you're hoping we'll do it for you ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Wow, pretty tough response since he didn't ask anyone to write it...he just asked for help or direction.
Who cares why he needs it....and why do you assume the worst??? Such a cutting response to assume he accepted a job and now he's hoping you all will do it for you.
God I hope you aren't in Tech support....
Ken
|
|
|
|
|
If u look around on net you will find the structure of GPS packet. U need to split it and get the longitude and latitude out of it and then map these points on ur screen's map..
I think this is the best i can tel you for a generic question u has asked for
Good
Lock
|
|
|
|
|
Hey gang!
I need you help with some codes to validate user input in a form to capture hours worked each day. I want to make sure that a number is input and also that the value is less than 16. Please help. The below was an idea I had, but I dont know where to place code and implement.
Sub ValidateHours()
Dim StrHours As String
StrHours = txtMonday1.Text
StrHours = txtTuesday1.Text
StrHours = txtWednesday1.Text
StrHours = txtThursday1.Text
StrHours = txtFriday1.Text
StrHours = txtSaturday1.Text
StrHours = txtSunday1.Text
StrHours = txtCTOused1.Text
If IsNumeric(StrHours) And StrHours < 0 Or StrHours > 24 Then
MessageBox.Show("ok. good")
Else
MessageBox.Show("Hours worked must be at least 0 and no greater than 24")
End If
End Sub
|
|
|
|
|
|
I wanted to close the loop on this and document my decided solution for the benefit of the next newbie that asks this question on validation.
I dragged a errorprovider component from the Toolbox onto my form. Then I place the following code afte the "leave" event for each field:
'begin data type error trapping here
erpTimeSheet.SetError(txtMonday1, "")
erpTimeSheet.SetError(txtTuesday1, "")
erpTimeSheet.SetError(txtWednesday1, "")
erpTimeSheet.SetError(txtThursday1, "")
erpTimeSheet.SetError(txtFriday1, "")
erpTimeSheet.SetError(txtSaturday1, "")
erpTimeSheet.SetError(txtSunday1, "")
If Not IsNumeric(txtMonday1.Text) Then
erpTimeSheet.SetError((txtMonday1), "Your hours must be a number")
txtMonday1.Focus()
txtMonday1.SelectAll()
txtMonday1.ForeColor = Color.Red
Exit Sub
End If
This works. Thanks
|
|
|
|
|
hi
I'm trying to write a code that create DB & tables in MS access using VB, when I excute my code the DB is created but I don't see any table in the DB when I open the access file.
Can any one tell me what's the problem?
This is my code:
Public Function CreateAccessDatabase(ByVal DatabaseFullPath As String) As Boolean
Dim bAns As Boolean
Dim cat As New ADOX.Catalog()
Dim table1 As New ADOX.Table()
Dim cn As ADODB.Connection
cn = New ADODB.Connection
Try
Dim sCreateString As String
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabaseFullPath
cat.Create(sCreateString)
bAns = True
Catch Excep As System.Runtime.InteropServices.COMException
bAns = False
'Open the connection
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\testdb.mdb")
'Open the Catalog
cat.ActiveConnection = cn
'Create the table
table1.Name = "Test_Table"
'Create and Append a new field to the "Test_Table"
'Columns Collection
table1.Columns.Append("PrimaryKey_Field", ADOX.DataTypeEnum.adInteger)
'Create and Append a new key. Note that we are merely passing
'the "PimaryKey_Field" column as the source of the primary key.
'Thi snew Key will be Appended to the Keys Collection of
'"Test_Table"
table1.Keys.Append("PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary, "PrimaryKey_Field")
'Append the newly created table to the Tables Collection
cat.Tables.Append(table1)
' clean up objects
table1 = Nothing
cat = Nothing
cn.Close()
cn = Nothing
Finally
End Try
Return bAns
End Function
|
|
|
|
|
Fromi what I've seen, this should work. The only problem I can see is that you are specifying the connection string twice, built by two seperate methods.
This is one method:
mesho wrote: Dim sCreateString As String
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabaseFullPath
cat.Create(sCreateString)
which takes a database file path as a parameter.
The other speicifies a very specific filepath, which could be very different from the above path:
mesho wrote: 'Open the connection
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\testdb.mdb")
'Open the Catalog
cat.ActiveConnection = cn
This is probably where you're probliem lies. You're looking in one file for the table, but the table was created in another file.
|
|
|
|
|
Hi There
I have an ownerdrawn listview that is drawing the text in listview1_drawsubitems just fine. My problem is I want to draw an icon in the listview1_drawitem (the first column.)
I am using the code below to add text to the listview (along with icons from an imagelist
If x=2<br />
Dim myItems As New ListViewItem("", 0)'0 is the first omage in the imagelist<br />
listview1.Items.Add(myItems)<br />
myItems.SubItems.Add(firstname)<br />
myItems.SubItems.Add(lastname)<br />
End If
And I want to use this code to draw the different icons in the different rows of the first column:
Public Sub myDrawIcon(ByVal e As PaintEventArgs)<br />
<br />
Dim newIcon As New Icon("sample.ico")<br />
Dim rect As New Rectangle(0, 0, 16, 16)<br />
e.Graphics.DrawIcon(newIcon, rect)<br />
End Sub
And I do not know how. I do not know what to pass as an agrument to the mydrawincon sub to draw icons instead of text in the first column.
The icons do not have to come from the imagelist I can do away with the imagelist and get the icons from my resources if need be.
Any help....Please
Thanks
|
|
|
|
|
Hi,
In regards to your query I would suggest you to try the following code snippet to add icons in the ListView from an ImageList.
--------------------------------------------------------------
BEGIN CODE
Images can be set programmatically when items are adding by setting the image index property of the new item:
Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles MyBase.Load
' Add a new item to the ListView
Dim item As ListViewItem = ListView1.Items.Add("Item6")
' Set the index into the image list
item.ImageIndex = 6
End Sub
END CODE
--------------------------------------------------------------
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Hello! In my project ,i'm using user controls to validate input to my database but any time i'm trying to build a setup project i have this error unable to update project dependencies.It it dues to my user control dll?Ive seen that many people have the same bug.I just need some guidance to build my setup.
PS:i did all the refencing stuff.Thanks
eager to learn
|
|
|
|
|
highjo wrote: i did all the refencing stuff
When you added references to these user controls, did you add the reference to the generated .DLL, or to the project that these controls were in?? I hope it was the project...
|
|
|
|
|
well!
actually i have oe projet A that uses user controls of the Project B.SO in the project A i added the reference to the project B.Then add deployment project to the Project A.Did something wrong?
eager to learn
|
|
|
|
|
The background is that my program adds data to a MS-Access data-bound table programatically.
Here is how I am testing:
1) I test the error handling by adding a record that I know will violate the primary key and I receive the OleDb.OleDbException exception. (OK, I can deal with that ...)
2) I then perform a successful addition of a record. (Still OK ...)
3) I then re-test the error handling by adding a record that I know will violate the primary key and now I recieve the ConstraintException exception. (Huh ???)
4) Now after I continue to test the program I will receive the ConstraintException exception.
It also appears that if I don't do some sort of cleanup then when I try to add a row that I know is good, it continues to fail because it is trying to add the record that previously failed. To get around this I added RejectChanges and RemoveCurrent logic and now my applications seems to operate correctly under all testing conditions. I just don't feel confident that this is the correct way to handle the situation.
Why am I getting 2 different execptions for the exact same code execution ?
Also, please tell me the best way to handle the situation of key/constraint violation.
Why should I have to Reject changes or remove the row from the BindingSource ?
Thanks,
David
Rough code sample follows:
<br />
Try<br />
<br />
schedDR = CType(CType(Me.PP_ScheduleBindingSource.AddNew, DataRowView).Row, TCDataSet._PP_ScheduleRow)<br />
<br />
schedDR.SchedDate = dTmp<br />
schedDR.SiteID = sSite<br />
schedDR.EmpID = sEmpID<br />
schedDR.TimeOpen = sOpenTime<br />
schedDR.TimeClose = sCloseTime<br />
<br />
Me.PP_ScheduleBindingSource.EndEdit()<br />
Me.PP_ScheduleTableAdapter.Update(Me.TCDataSet._PP_Schedule)<br />
<br />
Catch ex As OleDb.OleDbException<br />
schedDR.RejectChanges()<br />
MsgBox("caught dbException" + vbCrLf + ex.Message)<br />
<br />
Catch ex As ConstraintException<br />
Me.PP_ScheduleBindingSource.RemoveCurrent()<br />
MsgBox("Caught Constraint Exception" + vbCrLf + ex.Message)
|
|
|
|
|
Do the exceptions occur on the exact same line?? Usually, it's the exact nature of the data that causes differing exceptions. Sometimes a piece of data will violate the dataset's constraints, and sometimes it'll pass that, but bomb when written to the database. You'll get a different exception for each case. The dataset in code can't replicate the exact constraints comming out of the database.
|
|
|
|
|
I think I found the cause of the confusion on my part. It appears that previously my application was not calling the Me.PP_ScheduleTableAdapter.Fill(Me.TCDataSet._PP_Schedule) prior to attempting to update the table adapter.
My code now calls the Me.PP_ScheduleTableAdapter.Fill(Me.TCDataSet._PP_Schedule) during form_load and I can now consistently trap for the error; ConstraintException. Life is good.
Thank you for your help.
|
|
|
|
|
I have a UDT I created in SQL Server Express 2005 that is called time. I did not create an assembly so the date is always 1/1/1900.
I need to know how to get the time only from the data row.
How do I do that?
Here is a line of code in VB.NET. ts_from is the field in the database that hold the datetime value.
startTime = Convert.ToDateTime(row("ts_from"))
|
|
|
|
|
Why have you created a UDT? You can just use the datetime data type.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|