|
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
|
|
|
|
|
Hello
Thought I turn off option Type inference , I still has problem
Shared Sub Abc(Of T)(ByVal def As T)
End Sub
Shared Sub Abc(ByVal def As Object)
End Sub
Shared Sub New()
Abc("a string") '---> this line always calls Abc(Of String)(ByVal def As String)
'I really don't want to change existing code to Abc(CObj(""))
End Sub
|
|
|
|
|
You don't have a choice. Think of it this way... The compiler is going to automatically generate code specific to each type that uses this method. If you leave this setup the way it is, the method defined as ByVal def As Object will only be called when you pass something boxed in an Object type. Every other type will go to the generic version of the method.
|
|
|
|
|
I'm working on small desktop application and I need to create a Help file. Like every application made on Windows, that opens help/help file on F1 hit. But unfortunately I have never done this before!! Can anyone tell me how can I create (.chm) Help Module/file?
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
Download HTML Help Workshop
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Thanks! Just downloaded it. A bit confusing but will get used to it. Thanks again.
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
After then read this article i think since you have not done this before would be helpful
eager to learn
|
|
|
|
|
Thanks
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
hello.
it is necessary to create DSN for using crystal report.
without using DSN we can create a crystal report.
i want to generate a dynamic crystal report from visual basic 6.0 and backend used is oracle.
i tried it but giving error like 'server not yet been started'.
i don't know TNSname for oracle.
give me reply.
if possible then a code for generating dyanamic report. with backend oracle.
|
|
|
|
|
Hi all
i have created a new projected in vs2005.
added the cystal report designer to the form.
when i insert a new report, i get the following error....
"Crytal Reports Active X Designer" - msg header
"Failed to open document" - error msg.
2nd error box says
"Microsoft Visual Studio" - header
"Failed to create crystal query engine" - error msg.
i have created reports successfully before and dont know why i am getting this error.
i have unintalled crystal and re-installed, still did not work...even tried this = "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports\CRRedist2005_x86.msi"
no luck...
could you help..please as i need to get my projects out!!!!!
thanks
|
|
|
|
|
1 . tell me which Crystal Report Version you have to impliment with your project ?
2. Embeded Crystal Report or external ?
mitesh
|
|
|
|
|
hi, thanks for the reply....
problem has been sorted out,
was using vs2005..
|
|
|
|
|
Can you post your solution here, I am having the same issue.
Thank You
|
|
|
|
|
hi,
This is what caused my problem.
i un installed a program that was using crystal reports.
the uninstallation removed all components for crystal in the program files/common files directory.
this is why i was getting the error.
Solution....well kinda solution...
i re-installed that software which put back all the modules and now it works fine.
i dont know why the uninstallation removed the components, but it did,
i will have to live to the software installed even though i am not using it... i dont mind!
hope this helps!!!
|
|
|
|
|
I have a line of code that I am not sure why I am getting the blue underline when I have option strict on.
The error I get is the following:
Option Strict on dissalows implicit conversion from date to string.
I know that I can use the code Convert.ToDataType() to convert variables and/or objects.
Here is the line of code I am having troubles with.
startTime += startTime.Add(timeInterval)
The startTime in previous lines of code is converted from a dataRow object to dateTime. The timeInterval variable is a timeInterval dataType.
Does anyone know what I am getting the conversion error? Does the Add function convert startTime to a String?
|
|
|
|
|
AAGTHosting wrote: startTime += startTime.Add(timeInterval)
Shouldn't this be
startTime = startTime.Add(timeInterval)
Assuming that you want to add startTime and timeInterval and assign the result to startTime .
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
AAGTHosting wrote: startTime += startTime.Add(timeInterval)
That is the same as:
startTime = startTime + startTime.Add(timeInterval)
There is no operator overload for adding two DateTime values. Then only implicit convertion that allows adding, is turning both values to strings, so the compiler assumes that you mean:
startTime = startTime.ToString() + startTime.Add(timeInterval).ToString()
However, the result is a string, and can not be implicitly converted to a DateTime value, that is why you get that error message.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|