|
doesnt make sense. How does the application know that there is data on the clipboard to start the retrieval? Can the shell send the file list directly to the running app? How would the app be notified?
|
|
|
|
|
hi friends, can tell me how to Retrieve email attchment from POP3 server using vb.net.
Thank you
ravincarlos@yahoo.com
Share ur code & happiness on the net.
|
|
|
|
|
Hi everyone,
Was wondering if anyone has any insight into how to set the selected index of a comobox to -1 without firing the event twice. I am using a method/procedure/function that gets called when the combobox needs to set its selected index = -1. I have tried
Public Sub emptyIndex(ByVal e As System.EventArgs)
Me.SelectedIndex = -1
Call Me.OnSelectedIndexChanged(e)
End Sub
AND
Public Sub emptyIndex(ByVal e As System.EventArgs)
Me.SelectedIndex = -1
Me.SelectedIndex = -1
End Sub
AND
Public Sub emptyIndex(ByVal e As System.EventArgs)
Me.SelectedIndex = 0
Me.SelectedIndex = -1
End Sub
The first bit of code seems to fire the selected index changed twice. The second event doesn't fire at all, and the last event seems to fire the selectedindexchanged event 2 times. Hope to hear from anyone out there soon. Thank you and merry xmas
eatwork
-- modified at 13:20 Friday 23rd December, 2005
Not too sure if that makes sense. I will try this again...
I have a custom combobox. I am trying to code the custom control to autocomplete as the user types characters into the combobox. If the user presses backspace/delete or enters typed a value that does not exist in the list, I want the combobox to set its selected index to -1 and raise the selected index changed event when this happens. I have found the autocomplete combobox on this website that handles the keydown, keypressed, keyup events, and then I call a function called autocomplete. This function checks to see if the text is "", or if the typed value is similar to a value within the combobox. if the text is "" or there is no matching value I call the functin empty index. This function, after doing some research on .net comboboxes, sets the selected index to -1 twice, because if you set it only once it resets the combobox index to 0 if the current index is not 0. If the selected index = -1 already, the event that the selected index has changed will not be raised, becase nothing has changed. I need to know when the user typed values change the selected index to -1 because it will raise an envent when used on my winFrm.
Code:
Public sub AutocompleteFunction()
If typedText = "" Then
iFoundIndex = -1
Else
iFoundIndex = Me.FindString(typedText)
End If
If iFoundIndex >= 0 Then
oFoundItem = Me.Items(iFoundIndex) 'stores found item in an object
sFoundText = Me.GetItemText(oFoundItem)
concatenatedText = sFoundText.Substring(typedText.Length)
Me.Text = typedText & concatenatedText
Me.SelectionStart = typedText.Length
Me.SelectionLength = concatenatedText.Length
If e.KeyCode = Keys.Enter Then
iFoundIndex = Me.FindStringExact(Me.Text)
Me.SelectedIndex = iFoundIndex
SendKeys.Send(vbTab)
e.Handled = True
End If
Else
Call Me.emptyIndex(e)
If IsNothing(typedText) Or typedText = "" Then
If Me.Text <> "" Then
Me.Text = ""
End If
Me.SelectionStart = 0
Else
Me.Text = typedText
Me.SelectionStart = typedText.Length
End If
End If
End sub
Public Sub emptyIndex(ByVal e As System.EventArgs)
Me.SelectedIndex = 0
Me.SelectedIndex = -1
'Call Me.OnSelectedIndexChanged(e)
End Sub
Setting the value to 0 first, will ensure that the SelectedIndexChanged event is fired. but it raises that event twice, and I only want it to raise the event once. Setting the index to -1, -1 doesn't raise the event at all. Desperately in need of advice. Thanks
-- modified at 15:25 Friday 23rd December, 2005
|
|
|
|
|
are u looking for this???
me.comboBox2.Items.IndexOf(-1);
If me.comboBox2.SelectedIndex = -1
MessageBox.Show("comboBox2 item is -1")
else
MessageBox.Show("None")
endif
|
|
|
|
|
Hi Albanian,
Thanks for the response. I tried your code, but realized that the me.comboBox2.Items.IndexOf(-1) returns the value of the combobox. I am searching for code that will change the selected index of the combobox to -1 and raising the selectedIndexChanged event if the index is not currently -1. Not too sure if that makes sense. I will try this again...
I have a custom combobox. I am trying to code the custom control to autocomplete as the user types characters into the combobox. If the user presses backspace/delete or enters typed a value that does not exist in the list, I want the combobox to set its selected index to -1 and raise the selected index changed event when this happens. I have found the autocomplete combobox on this website that handles the keydown, keypressed, keyup events, and then I call a function called autocomplete. This function checks to see if the text is "", or if the typed value is similar to a value within the combobox. if the text is "" or there is no matching value I call the functin empty index. This function, after doing some research on .net comboboxes, sets the selected index to -1 twice, because if you set it only once it resets the combobox index to 0 if the current index is not 0. If the selected index = -1 already, the event that the selected index has changed will not be raised, becase nothing has changed. I need to know when the user typed values change the selected index to -1 because it will raise an envent when used on my winFrm.
Code:
Public Sub emptyIndex(ByVal e As System.EventArgs)
Me.SelectedIndex = 0
Me.SelectedIndex = -1
'Call Me.OnSelectedIndexChanged(e)
End Sub
Setting the value to 0 first, will ensure that the SelectedIndexChanged event is fired. but it raises that event twice, and I only want it to raise the event once. Setting the index to -1, -1 doesn't raise the event at all. Desperately in need of advice. Thanks
eatwork
|
|
|
|
|
Based on the e arguement, I am assuming that your Sub emptyIndex is called from an event handler. Is this correct? How is this sub being called.
It looks like it is being called when something happens with the combobox. If so, then:
example 1: If SelectedIndex is something other than -1, then setting it to one will trigger OnSelectedIndexChanged. Then you call it explicitly.
example 2: If SelectedIndex is already -1, then setting it to -1 twice, or even once, will not change it, and it will not trigger OnSelectedIndexChanged.
example 3: If SelectedIndex is anything other than 0, then when you change it to 0, it triggers OnSelectedIndexChanged, and then again when you change it to -1.
Perhaps you want something like this:
Public Sub emptyIndex(ByVal e As System.EventArgs)<br />
if Me.SelectedIndex.Equals(-1) then<br />
Call Me.OnSelectedIndexChanged(e)<br />
else<br />
Me.SelectedIndex = -1<br />
end if<br />
End Sub
Good luck
Roy.
|
|
|
|
|
Hi Roy thanks for your response,
Yes the sub empty index is called when the keyup event is raised. Your examples are 100% on the mark. However, your suggested code does not seem to work in my combobox, or it is not performing as intended. Am I missing something? Thank you for your help. Really appreciate it.
eatwork
|
|
|
|
|
I have VbNet2005 desktop application that also needs to deploy a dll created in C++. How do I add the dll to the VB deployment project so that it gets installed at the same time? Thanks.
|
|
|
|
|
If the DLL is a standard "C" style DLL that does not require registration (as opposed to a COM DLL) simply add it to your setup development project as a file and set the install folder to the application directory, or the WinSys folder.
If the DLL is a COM DLL then it presumably is already referenced by your NET project and the wizard should add it to the setup automatically. In this case you also need the Primary Interop Assembly (PIA) for the C++ DLL. Again, the setup wizard usually, but not always, adds everything else you need to register a COM DLL referenced by a NET project.
In either case, you must also pay attention to any additional dependency DLLs your C++ DLL may require. You can use the Dependency Walker utility to determine dependency DLLs. If these are all standard system DLLs you should not have to add any dependencies on Win2K or higher systems.
Finally, be certain to test your setup on a "clean" machine - i.e. one with a fresh OS install, but no development tools. Setups generally always "work" when tested on a dev machine, but may easily fail on a "field" target machine.
|
|
|
|
|
Thank you thank you. I followed your detailed instructions and I have installed it on a clean test machine successfully. Thank you for your valuable time and your level of detail.
DD
|
|
|
|
|
I am trying to create a internet browser that will go to a specific site on the net. I can get this to work but when I use the exe on another pc I get errors. (Mozctl.dll missing) I want to use Mozilla and not Internet Explorer. Also the width and height is set to those numbers for a specific reason. I have used this in the past to assist in spyware and virus removal.
Here is my code:
Private Sub Form_Load()
Form1.Width = 11750
Form1.Height = 8475
MozillaBrowser1.Width = 11750
MozillaBrowser1.Height = 8475
MozillaBrowser1.Left = 0
MozillaBrowser1.Top = 0
MozillaBrowser1.Navigate "http://www.helpmeremoveavirus.com"
End Sub
Private Sub Form_Resize()
MozillaBrowser1.Width = Form1.Width
MozillaBrowser1.Height = Form1.Height
End Sub
|
|
|
|
|
From the error message you've given, Mozilla is not installed on that machine, or the correct version is not installed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello,
I have used two datasets for two tables and i have to pass these two datasets into datagrid.. i am using sqlserver 2000
plz help in this regarding,
Thanks & Regards,
Nagalakshmi
-- modified at 6:16 Wednesday 21st December, 2005
|
|
|
|
|
OK. What's the problem?
Do you need to know how to bind a dataset to a datagrid? Are you having problems switching to the second dataset? Are you trying to bind both datasets to the datagrid at the same time?
Roy.
|
|
|
|
|
Firstly I am not clear why you are trying to use two datasets. In my experience a single dataset se globally for the application will meet all the needs and is of course much easier to administer and control. You can keep adding and removing tables from them as and when you need it.
That apart, if you want to just attach the datatable to the datagrid set it as the datasource of the grid.
On the other hand, if you want to extract data from both the datasets and present it in a single datagrid, then I am afraid you must first extract the required info from the datasets in to a single table and then datasource it to the grid.
Hope this helps.
Varadarajan R
|
|
|
|
|
What kind of database are you using?
1.SQL Server
2.MS Access
Paul
|
|
|
|
|
Hi all,
I'm using MSXML to load and parse serveral xml files (obvious ). All works fine while the encoding of the file is utf-8 but when i load a file that has the following header
?xml version="1.0" encoding="UTF-16"?
i get an error telling me that this encoding is not supported.
How can I load files encoded in utf-16?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
I have a project with a number of classes from which I've created a dll.
Within this project is a usercontrol object.
When I reference the dll created from the project I can't handle any events that I've created myself. I can handle the leave event for example.
I presume that the event is being raised because if I try and handle it using code inside the initial project containing the usercontrol the evtn is raised and handled.
The usercontrol is defined as friend and withevents and all the events are public that I want to handle.
The events are passed through three objects. For example, usercontrol1 has a child object1 and object1 has a child object2.
usercontrol-->object1-->object2
The initial event is raised in object2, handled by object1 which raises its own event, this is handled by usercontrol which then raises its own event and it is this final event, triggered by the first event, that I want to handle.
I seem to figure it will be something to do how I idnetify things (public/private/protected/friend) as it works inside and not outside the project. I just don't know where.
Any help would be gratefully appreciated.
An optimist's glass is half full.
A pesimist's glass is half empty.
An engineer goes and gets the right size glass.
-- modified at 18:43 Tuesday 20th December, 2005
I've found the solution at:
http://www.vbip.com/books/1861004915/chapter_4915_09.asp
|
|
|
|
|
I've found the solution at:
http://www.vbip.com/books/1861004915/chapter_4915_09.asp
An optimist's glass is half full.
A pesimist's glass is half empty.
An engineer goes and gets the right size glass.
|
|
|
|
|
I am trying to create an editable listview, where user can edit the data from a specific cell. I wish the put a textbox visible on the specific cell's position, so that the listview is seems to be editable by passing and retrieving the text from the textbox. Is there any way to find out the position of the particular cell in listview?
Thanks a lot
|
|
|
|
|
Here is a routine I've used as part of a subclassed listview that displays a textbox over a specific cell in the listview. The signature of the method indicates the row and column coordinates.
Private subItemSelected As Integer = 0
Private subItemText As String
Private subItemSelected As Integer = 0
Private WithEvents editBox As New TextBox
Private strOriginalText As String
Public Sub ShowTextBox(ByVal lvi As ListViewItem, ByVal subitem As Integer)
Dim localLI As ListViewItem
Dim nStart As Integer = X
For Each localLI In Me.Items
If localLI Is lvi Then
'Found the item they passed in.
li = localLI
Dim liBounds As Rectangle = li.GetBounds(ItemBoundsPortion.Entire)
If subitem >= 0 And subitem <= Me.Columns.Count - 1 Then
'Their subitem is valid.
Dim i As Integer
Dim spos As Integer = liBounds.X
For i = 0 To Me.Columns.Count - 1
If i = subitem Then
'We found the subitem they indicated and now have the bounds.
subItemSelected = i
Dim epos As Integer = spos + Me.Columns(subitem).Width
subItemText = li.SubItems(subitem).Text
editBox.Size = New System.Drawing.Size(epos - spos, li.Bounds.Bottom - li.Bounds.Top)
editBox.Location = New System.Drawing.Point(spos, li.Bounds.Y)
editBox.Show()
strOriginalText = subItemText.Trim
editBox.Text = subItemText.Trim
editBox.SelectAll()
editBox.Focus()
Exit For
End If
spos += Me.Columns(i).Width
Next
End If
End If
Next
End Sub
|
|
|
|
|
Thanks for your solution... however i still have to pass the index of the selected subitem into your routine... and i haven't found the way to get the index of the subitem...
Can you tell me how to get it?
Thanks you very much
-- modified at 2:37 Wednesday 21st December, 2005
|
|
|
|
|
Oh yes, I should have included that.
In the MouseDown event you have the coordinates of the mouse which you can use to determine which column the user clicked in. When I subclassed the listview, I added this:
Private _subitemClicked As Integer
Private li As ListViewItem
Private oldLI As ListViewItem
Private strOriginalText As String
Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
Dim X As Integer = 0
Dim Y As Integer = 0
oldLI = li
li = Me.GetItemAt(e.X, e.Y)
X = e.X
Y = e.Y
'Determine the subitem clicked.
If Not li Is Nothing Then
Dim nStart As Integer = X
Dim liBounds As Rectangle = li.GetBounds(ItemBoundsPortion.Entire)
Dim i As Integer
Dim spos As Integer = liBounds.X
For i = 0 To Me.Columns.Count - 1
If nStart >= spos And nStart < (spos + Me.Columns(i).Width) Then
'We found the subitem they indicated.
_subitemClicked = i
Exit For
End If
spos += Me.Columns(i).Width
Next
End If
'Now call any custom code the developer may have added behind the form.
MyBase.OnMouseDown(e)
End Sub
I then added a property which returned the subitem clicked:
<browsable(false), description("gets="" the="" zero-based="" index="" of="" column="" clicked."),="" _
="" category("appearance")=""> _
Public ReadOnly Property SubitemClicked() As Integer
Get
Return _subitemClicked
End Get
End Property
So when you need to display a textbox you can use the Click event:
Private Sub lvwLeft_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvwLeft.Click
Me.lvwLeft.ShowTextBox(Me.lvwLeft.SelectedItems(0), Me.lvwLeft.SubitemClicked)
End Sub
Now you need a way to transfer the contents of the textbox back to the listview cell. First add this line to the ShowTextBox method right after the editBox.Show() line:
strOriginalText = subItemText.Trim
Add these lines globally to your subclassed listview:
Private bolSkipUpdate As Boolean = False
Public Event ListviewItemChanged(ByVal item As ListViewItem, ByVal subitem As Integer)
Now add these routines:
Private Sub editBox_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles editBox.KeyUp
If e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Tab Then
li.SubItems(subItemSelected).Text = editBox.Text
editBox.Hide()
End If
If e.KeyCode = Keys.Escape Then
bolSkipUpdate = True
editBox.Hide()
bolSkipUpdate = False
End If
End Sub
Private Sub editBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles editBox.LostFocus
If Not bolSkipUpdate Then
oldLI.SubItems(subItemSelected).Text = editBox.Text
If strOriginalText <> editBox.Text Then
RaiseEvent ListviewItemChanged(oldLI, subItemSelected)
End If
editBox.Hide()
End If
End Sub
Now, whenever the contents of the textbox are changed and committed to the listview, the ListviewItemChanged event will get raised so you can write custom code to handle it.
Ideally, you want to subclass the listview and include all this code. Otherwise you'll have to duplicate it for every instance of your listview.
Dean
|
|
|
|
|
Thank you so much.. you have solved my problems.. =)
|
|
|
|
|
Dear all.
I m using dll file in my webpage using ASP.now I want my dll to generate a html file and store it into client machine using this web page.My problem is that generated file is currently saved at server.I want it must store this html file on everyone's machine who is using this webpage.Hope so you will understand my problem.I have devloped my dll file in vb.net.
help me all the way.
Urgently required!!
Uttam kumar
trickyuk001@rediffmail.com
try to be the best... whereever you go,
|
|
|
|