|
Hi Guys,
First off all, thanks for all the replies.
Like i said before the sdk is UUUGLY! so the refresh method would make no sense to you guys anyway without the supporting docs. In short all it does is assign Nothing to the Customer class and loop through something that was meant to be a collection in the SDK classes etc.
In any case you're fixating on the wrong thing. The collection either way i declare it generates the exact same issue. I even tried this with a structure called Customer instead of a class and the structure would have a private var to store stuff. The exact same ..it happenz!
As Michael said i pass the Customer in correctly, the collection, God love it!, is properly initialized and gets its first element fine. BUT the moment i Nothing the Customer class instance that was passed BYVAL to the frigin collection, the instance of the class in the collection gets Nothinged as well.
HOW THE ... ... .... ......... IS THAT POSSIBLE?????????????
The instance that gets Nothing is outside the scope of the sub or the collection class, and even if it wasn't it's passed BYVAL for crying out loud.
That’s my current concern!
I really appreciate your assistance but I will havta end my life now...probably very violently!
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
I don't think you understand how ByVal works when using objects/classes.
For objects (that is, reference types) ByVal means that the function being
called cannot overwrite the *reference* to the object instance which is
actually passed in the parameter variable. But it does not prevent the
callee to alter properties on the instance.
ByRef, on the other hand, enables the callee to overwrite the reference
itself and therefore substitute the original object instance with another
one.
Mike Lasseter
-- modified at 8:30 Monday 24th July, 2006
|
|
|
|
|
Hi Friends,
I am creating an application in vb.net which will be download all files of latest date from FTP server.
I have found all files from FTP server through my code.But I do not understand how to download files from FTP Server to client location.
If any one can help me that will be really appreciate.
It's very urgent.
Regards & Thanks
Sunil
|
|
|
|
|
|
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.
|
|
|
|