|
Hi,
Thanks for help but perhaps I forgot to mention that I have .NET 1.1
which don't support some properties which are in 2.0.So,can you suggest me any solution for .NET 1.1 ?I really appreciate your help.
Regards & Thanks
Sunil
|
|
|
|
|
Hi all,
I have a ListView control on a VS2003 WinForm which I am populating successfully with JPEG images using the LargeIcon setting. This works fine so I added code to handle the SelectedIndexChanged event so when the user clicks on one the icons (ie: the images displayed as thumbnails) the full image will appear in another tab. (The ListView MultiSelect property is turned off BTW)
Ok, so this works perfectly the FIRST time... but when I try to select any image after that I get this error (marked in the code below where it occurs):
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll
My event handler is below - anyone know what the heck is going wrong here?!!? My listview still seems to have all it's items and the correct indexes as well so I'm simply stumped as to what's going on.
Mike
PS: I'll google as well but I have a big deadline so any help will be appreciated!
Private Sub lvwImages_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvwImages.SelectedIndexChanged
Dim ndx As Integer = lvwImages.SelectedItems(0).Index 'CODE FALLS OVER HERE!!!!
Dim strImagePath As String = lvwImages.Items(ndx).SubItems(0).Text 'The image filename
Dim img As Image = Image.FromFile(strImagePath)
'picFullImage is a Picturebox control on another tab.
picFullImage.Width = img.Width
picFullImage.Height = img.Height
picFullImage.Image = img
End Sub
-- modified at 5:31 Friday 21st July, 2006
|
|
|
|
|
Try using the FocusedItem property of the ListView.
from memory, try something like this
you have
nzmike wrote: Dim ndx As Integer = lvwImages.SelectedItems(0).Index 'CODE FALLS OVER HERE!!!!
Dim strImagePath As String = lvwImages.Items(ndx).SubItems(0).Text 'The image filename
I suggest
...
Dim strImagePath As String = lvwImages.FocusedItem.SubItems(0).Text
...
Saves you having to declare the "ndx" variable as well.
I find the FocusedItem property far more useful than SelectedIndex when using a ListView.
I hope this solves your problem.
|
|
|
|
|
Thanks - hadn't used that before so it's good to know about. What I ended up doing (with my client's agreement) was making the user double-click on an image to show the image and that does work perfectly every time with the same code - I can only guess that the event handler for SelectedIndexChanged has a bug. Appreciate the input though - will use FocusedItem next time!
-- modified at 5:59 Friday 21st July, 2006
|
|
|
|
|
It's not a bug but I don't have a valid technical explanation for it. I think (i stand under correction) that it has to do with the variable's scope and how it's pointed to by the CLR. Never bothered to look it up, but I know it's not a bug.
|
|
|
|
|
Its not a bug. What is actually happening is the SelectedIndexChanged event is thrown twice when a new selection is make. The Selected Index is removed from the current selection and moved to a different selection.
You could and should always check to make sure the SelectedItems Collection of the ListView has an item in it.
Mike Lasseter
|
|
|
|
|
Ok, that makes sense - I guess I didn't really think that it would get fired twice but it stands to reason I suppose since the first image is being de-selected that it would fire. I'm keeping with the double-click method now though as my client now prefers that over the single click anyway.
Cheers,
Mike
|
|
|
|
|
how can we scann the cd in VB.NET
jinal
|
|
|
|
|
Please be more specific. We can't help you if we don't know what you're asking.
|
|
|
|
|
I am currently using a VB.NET program to send out e-mails with
plain text bodies (plus one attachment). The emails are being
received as Rich Text messages (probably just my personal Outlook
default, because I didn't do this in the program), but there is no
actual formatting (italics, color, etc.) in the message body, which
is passed to from VB.NET to Outlook as an unformatted text String.
I want to start applying formatting to the message body. In
particular, my app has a RichTextBox, which has an Rtf property,
which returns a String formatted as RTF, which contains whatever
my users type or paste into the RichTextBox. That is what I want
to send as the body of the message.
Unfortunately all I get is garbage, like this:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fprq2\fcharset0
Times New Roman;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\f0\fs24 This is \cf1 rich\cf0 \b\i text.\par
\b0\i0\par
\pard\f1\fs17\par
}
This is of course precisely the content of the input String,
formatting and all. Clearly I have failed to clue Outlook in that
the message body should be interpreted as RTF, not plain text. So
how should I do this?
Here is my code:
=== Begin Example ===
Imports Outlook = Microsoft.Office.Interop.Outlook
...
Sub MailerRoutine(ByVal Subject As String, ByVal Recipient As String, _
ByVal Body As String, ByVal Filename As String, ByVal displayName As String)
Dim oApp As Outlook.Application = CreateObject("Outlook.Application")
Dim oItem As Outlook.MailItem = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oItem.Subject = Subject
oItem.To = Recipient
oItem.Body = Body
oItem.BodyFormat = Outlook.OlBodyFormat.olFormatRichText
Dim bodyLength As String = oItem.Body.Length
Dim oAttachments As Outlook.Attachments = oItem.Attachments
Dim oAttachment As Outlook.Attachment
oAttachment = oAttachments.Add(Filename, , bodyLength + 1, displayName)
oItem.Send()
oItem = Nothing
oApp = Nothing
End Sub
=== End Example ===
For Oriensoft Technologies Pvt. Ltd.
Govind Yadav
Software Developer
E-mail: govindy@oriensoft.com
Tel: +91-22-67111555 Fax: +91-22-67111666
24 x 7 Support & Sales Toll Free : 1-800-22-5171 (India Only)
Web : http://www.oriensoft.com
|
|
|
|
|
I having problem when compare the date with the SQL, wats wrong with my code?
There are problem when i click the button on the function
"No value given for one or more required parameters"
It show the problem was in "Adodc1.Referesh"
but i not sure wats problem with it?anyone can help?
Dim today As Date
today = Now
sql = "select * from CO where [WarrantyValid]>today"
Adodc1.RecordSource = sql
Adodc1.Refresh
DataGrid1.Visible = True
|
|
|
|
|
campbells wrote: sql = "select * from CO where [WarrantyValid]>today"
Should this not be:
sql = "select * from CO where [WarrantyValid]>GetDate()"
|
|
|
|
|
i have try is but it said undefined function 'GetDate' in expression...
|
|
|
|
|
I think it should be:
sql = "select * from CO where [WarrantyValid]>" & GetDate()
|
|
|
|
|
or
sql = "select * from CO where [WarrantyValid]>" & today
|
|
|
|
|
Hi, I am working a project using visual basic studio 2005 as an interface design, microsoft sql 2005 as data store and crystal report for report engine. I am working with my local language by using unicode. However, the display on the interface itself it looks perfect however, when we view it with crystal report, it does not display properly at all.
For your understanding, Cambodia spelling is much difference from English. It has consonant with vowel and extended vowel which can be on the left, right, top, bottom, upper top, and lower bottom of consonant. The problems, is with the display of vowel, it seperated out.
Anyone outthere can solve this issue please help?
Regards,
Sithy
Sithy
|
|
|
|
|
Hi:
There is one parent form and several form mdichildren. In each child form there may be one to many controls. Information in one control is associated with other controls which may be in the same child form or in different forms.
The question is how to notify other controls if one control content is changed. What design policy (e.g. using design patterns such as Observer,or others) is appropriate ? Is there any sample I can refer to? Thanks.
David
abc
|
|
|
|
|
Your requirement is little unique so the solution would be unique too. I have one suggestion there might be many from others. well do the following
1. Build One Function on every Form with these parameters
public Function ControlAlert(FormName,Controlname,Value,any other parameter if required)
''' do here what you want to do if any other control has changed value
end function
2. on change of all the controls lying on all the forms. call one function which you will be created in your Global Module say
public sub ControlValuechanged(FormName,ControlName,ControlText)
' Over here you will get the reference of all the forms by using MDIForm Child loop and will pass the parameters to those forms in function
ControlAlert which you created on Step 1 like this
Dim frm As Object
For Each frm In MDIMain.MdiChildren
frm.ControlAlert(parameters)
Next
end sub
Rizwan Bashir
|
|
|
|
|
Your solution sounds viable. Yet I learned there are some design policies/patterns that can provide more elegant way to deal with that issue. I'll use your solution and explore design patterns as well.
Any advice besides the solution above is appreciated.
David
abc
|
|
|
|
|
i have a problem on merging 2 lists with 5 inputs on each list. the five inputs were already sorted and i'm trying to have a function to merge it. this is my defining function:
void merge(numA[],numB[],numAB[])
{
}
how can i merge the inputs in numA[] and numB[] and put them in the array of numAB[]?
|
|
|
|
|
Have a look at the Array.CopyTo method. If the final array also needs to be sorted than just make another call to Array.Sort to sort it afterwards.
|
|
|
|
|
Hi. I have a general question about custom controls. I want to make a control on a windows form that has a nonrectangular shape and the control itself is divided into several nonrectangular shapes. I need to divide the control because i want the different areas in it to have different properties.
I'd be very grateful if someone gives me a general advice on how to achieve that. I've already tried with transparent labels over a picture representing the control, but it is not nearly as good as i need it to be.
Thank you in advance.
|
|
|
|
|
A possible cheat/workaround...
Depending on how graphic you want your controls to be here's an idea (untested - something I've thought of doing but never got around to).
1. Draw your custom control in Flash (I choose Flash coz it's simple and powerful),
2. Add a Shockwave Flash object to your toolbox.
3. Create a new custom control, adding the Flash object to it.
4. Give the control applicable events like onClick, onMouseEnter/Leave, etc.
5. Use GDI+ to cut out the unwanted square bits around your control (using GDI+ available here[^]).
6. Build and test.
As mentioned earlier, I have yet to try this myself so I'm not completely sure that it'll work tho I don't see why it shouldn't given a little elbow grease. The choice of doing it this way is yours, you take my advice at your own peril
Good luck, if you get it to work please let me know - i'd be very interested to see.
|
|
|
|
|
Thank you for the reply. I am not used to using any of the macromedia products but here's a good reason to try them out As soon as I finish the control i will write you back.
Thanks once again.
|
|
|
|
|
Hello,
I'we been looking for tutorials about how to create buttons that reacts mouse events in Direct3D application. So basicly I just want to create a normal button but later on I need to make different shaped buttons, like triangle and round.
I understand the basic consept behind the buttons, but I can't figure out how to calculate the coordinates when the mouse is over buttonarea. Basicly only thing that should be somehow calculated is that where are the coordinates that are on button are. I was thinking to draw the buttons with vertixes, but the buttons are invisible for the user, because the buttons only work as a hit points and they register that if user presses the mousebutton over them.
Any idea where I could find tutorials for these?
|
|
|
|