|
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,
|
|
|
|
|
This question is better asked in the ASP.NET Forum.
But, since the file system of a client machine is off-limits to your code, you can only send the file to the client. They'll actually have to pick a spot to save the file themselves, just like downloading any other file, like a .ZIP.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dear Code project
I am a student in software engineering in under graduate.I want to do a mini project in network exam.for that i used your unolib.net for file transfer and message pass.But i get an earror as "remote ip not reachable".please give me the solution.with out this solution i can't do my project.So i request to all members of Code project to help me please
faithfully
Sivakumar
|
|
|
|
|
|
nandhusivakumar wrote: So i request to all members of Code project to help me please
All 2.5 million of them? That's a lot of help!
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
You best help is going to come from the person who wrote the article your refering too. We, meaning all of us at The Code Project, didn't write this library. An individual did. So ask him/her...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'll clearly tell my exact requirement
1. I have a standard exe project.
2. I also have a compiled chm file.
3. What i want is in my standard exe project whenever a user presses F1 i need to show him the chm file inside this form itself (Inside the application).
4. Or suggest me is there any others ways that i can do this work.
|
|
|
|
|
|
This would be an easy question if I where sitting at home in front of my computer, but as given you where nice enough to move this question to the correct from (out of the lounge) then I will try and help you.
There are a few things you need to do (I'm assuming here that you are using VB6, from what I have seen adding html help to VB.NET is a little easier).
First tell your app where the chm file is located
App.helpfile = [path to help file]
or
App.helpfile = app.path & “\mychm.chm”
If you looking for just a simple link then your done, however if you want each dialog to access its own help page within the chm file then you need to do a little more work.
First each help page will need a unique identifier; this is done in a header file as defines. In other words create a new text file. Give it the same name as your help file and change the file extension to .h
Inside of that fine define your page identifiers, like so.
#define IDH_MYHELP 2001
Open the MS Help workshop project now; now this is where we rely on my memory, if you right click on project properties look for mmm an area to add the defines (sorry about this I'm terrible at remembering the small details). It will only allow you to add a header file (*.h).
The next thing to do is create an alias in MS Help Work Shop to link the above defines to the actual webpage’s. In the same place that you included the above header there is a tab called “Alias” in here you will need to actually link the above defines to the actual web page.
Once you have completed the above operations flip back to your vb project each dialog has a property called HelpID add the numeric integer that you defined in the header file.
Re-compile the entire project (help file include) and all should be linked together.
Hope this helps…
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
-- modified at 3:41 Tuesday 20th December, 2005
|
|
|
|
|
tsnarayanan,
If that was you who just sent me an email, please use the public forms as so others may benefit. It’s generally only considered polite to email after you have asked permission (at least with myself anyway).
If I have mistaken your identity then please forgive me.
Are you having difficulties? Or was my explanation good enough to get you going? If not I can certainly work on a better explanation in a few hours.
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
hi,
I want to create a excel file in vb..the data is in 4textbox(let).
those information has to go to the EXCEL file.
Paritosh
|
|
|
|
|
Private Sub Command1_Click()
Dim ExcelBook As Excel.Workbook
Dim Esheets As Sheets
Dim Esheet As Excel.Worksheet
Dim ExcelApp As Excel.Application
Set ExcelApp = New Excel.Application
Set ExcelBook = ExcelApp.Workbooks.Add(1)
ExcelApp.Visible = True
Set Esheets = ExcelBook.Sheets
ExcelBook.Activate
Set Esheet = Esheets(1)
With Esheet
.Activate
.Cells(1, 1) = Text1.Text
.Cells(1, 2) = Text2.Text
.Cells(1, 3) = Text3.Text
.Cells(1, 4) = Text4.Text
.SaveAs "C:\1.XLS"
End With
ExcelBook.Close
ExcelApp.Quit
Set Esheet = Nothing
Set Esheets = Nothing
Set ExcelBook = Nothing
Set ExcelApp = Nothing
End Sub
|
|
|
|
|
Don't forget to tell him to Add the reference of Microsoft Excel.
|
|
|
|
|
I am trying to create a windows application with just the form floating around and bouncing off when it hits the edge of the monitor with some text being displayed. How do I do this?
|
|
|
|
|
I am the one; I am genius wrote: I am the one; I am genius
Well... you're the genius - you tell us
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
You're really killing me!
|
|
|
|
|
He neither gave you a fish, nor a snippet of code ...
<< >>
|
|
|
|
|
I am writing a dictionary same as "Just Click'n'See" software (English to Vietnamese).
I want to read text under mouse from any Application.
I am using Hook technology to determine Window which is activing. Example, when I click mouse in the text of any application then I want to put that text into a variable. Please help me.
Thank you very much.
|
|
|
|
|
You can use the hook of Global
|
|
|
|
|
I am sorry. I don't know your idea. Please write more detail. Thanks!
thank you for helping
|
|
|
|
|
MyNothing wrote: You can use the hook of Global
This makes as much sense as screen doors on a submarine.
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
really I don't know the way which you show me. Can you tell clearly?
thank you for helping
|
|
|
|