|
hi!
i have a problem in listbox
i want to add items from textbox to listview
im using following code
but it didnt work
code
lstv.Items.Add(Me.txtStatusId.Text.ToString)
lstv.Items.Add(Me.txtStartSerial.Text.ToString)
lstv.Items.Add(Me.txtEndSerial.Text.ToString)
lstv.Items.Add(Me.txtBenefit.Text.ToString)
lstv.Items.Add(Me.txtDiscount.Text.ToString)
lstv.Items.Add(Me.txtQuantity.Text.ToString)
lstv.Items.Add(Me.txtTotalAmount.Text.ToString)
it adds data to listview in rowwise i want to add data columnwise
note: lstv is the listview and txtStatusId is textbox etc
-- modified at 7:59 Monday 7th August, 2006
khurram saddique
|
|
|
|
|
Dim lst as new listViewItem(Me.txtStatusId.Text.ToString)
lst.subitems.add(---)
lst.subitems.add(---)
lst.subitems.add(---)
lst.subitems.add(---)
lstv.items.add(lst)
|
|
|
|
|
skhurams wrote: i want to add data columnwise
Use lstv.Items.SubItems .
|
|
|
|
|
One of my pet-peves. Why are you calling .ToString() on a Text property?? Text already returns a String, so you don't need to be calling .ToString() on it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
That bugs you too?
|
|
|
|
|
I wonder if anyone could help.
How can disable or the X on a form but keep minimize button
Protected Overrides Sub OnClosed(ByVal e As System.EventArgs)
The reason is because I could have another form (child of MDI) open at the time. I want to be able to say "There is a form open cannot do this close"
Is there any code to do this or is it just a case of properties of a form.
|
|
|
|
|
on close event you get e in paramter
write
e.cancel=true ' this is stop from closing and then you can do
me.windowstate= minimize,maximized etc
or what ever
|
|
|
|
|
Not sure about removing the close button without removing the minimize button. You could use the Me.ControlBox = False property but that'll remove minimize, maximize and close.
I think a better solution would be to use the OnClosing method of the form object and set the e.Cancel = True property depending on the conditions you have set.
|
|
|
|
|
Looking at API Guide (very useful program), I found some code in VB that can help you with disabling the close button. I may post back with some udpated .NET code (I have wrote VB and VC# versions but I am at wrong computer), but as of right now this is all that I can contribute. You could also try googling the subject.
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
Private Sub Form_Load()
Dim hSysMenu As Long, nCnt As Long
' Get handle to our form's system menu
' (Restore, Maximize, Move, close etc.)
hSysMenu = GetSystemMenu(Me.hwnd, False)
If hSysMenu Then
' Get System menu's menu count
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
' Menu count is based on 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE ' Remove the seperator
DrawMenuBar Me.hwnd
' Force caption bar's refresh. Disabling X button
Me.Caption = "Try to close me!"
End If
End If
End Sub
|
|
|
|
|
hellow to all ..
can i load OnPaint More than one time at the same forum ?
let say i wanna load OnPaint when i click on a button ?
i am trying to do so , but i recive an error ..
help please ..
thxxx
|
|
|
|
|
What do you mean by "load OnPaint"?
What is the code that you used, and what error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
i do not get error message ..
but what i wanna do is to be able to call OnPaint , can i call it let say from a button click when i click on the button ?
|
|
|
|
|
microuser_2000 wrote: i do not get error message ..
What did you mean by "but i recive an error", then?
but what i wanna do is to be able to call OnPaint , can i call it let say from a button click when i click on the button ?
You could, but that is not the proper way of redrawing a control. Call the Invalidate method of the control, that will put a message in the queue that tells the message pump that the Paint event has to be called to redraw the control.
---
b { font-weight: normal; }
|
|
|
|
|
me.refresh() forces the form to redraw .. hopes this helps.. also
me.invalidate() I think this also do the same thing.. not sure for this option
|
|
|
|
|
me.invalidate will repaint the entire control.
|
|
|
|
|
Hi,
I am using the contextmenustrip in an application and add the items programmatically at runtime.
What I cant figure out is how to add a second level to the menu, like:
MenuItem 1
MenuItem 2 -> SubItem 1
MenuItem 3
Any help would be highly appriciated.
/Jens
-- modified at 5:20 Monday 7th August, 2006
|
|
|
|
|
Though I can provide you the code but the best thing is you do it your self...
in the design time add the child menu as you like and see the code in the windows designer code area. the same way you have to add dynamically.. also you need the addhandler option with one procedure to add the handler for a dynamically added menu item
|
|
|
|
|
Any ideas how I can have the dropdown portion of a combobox to stay down after it has lost focus. I am tring to attach a tooltip but when my tip pops up the combobox looses focus and the drop down goes back up. I am using vb.net.
Mark Thibodeaux
|
|
|
|
|
|
This is not exactly what I am looking for. Any other suggesttions?
Mark Thibodeaux
|
|
|
|
|
You could override the WndProc for the combo box and prevent the DropDownClosed message from being given to the ComboBox.
|
|
|
|
|
Hi,
I've seen people complain about this error other places, but noone ever answers them...
Can't find solution to this erro message:
'c:\documents....\...xls' could not be found. Check the selling blah blah blah
(it appears in excel when clicking the send to excel button)
It seems it's trying to open a file that doesn't exist yet or something...
Then I can click the button on my apsx page again, and it will work fine in excel...
But any help solving this problem will be very appreciated...
I'm sure some of you have seen this probelm before? :s
-- modified at 4:20 Monday 7th August, 2006
the code:
Response.Clear()
Response.Buffer = True
Response.AddHeader("Content-Disposition", "attachment;filename=Wells.xls")
Response.ContentType = "application/vnd.ms-excel"
Me.EnableViewState = False
Response.Charset = String.Empty
Dim myTextWriter As New System.IO.StringWriter()
Dim myHtmlTextWriter As New System.Web.UI.HtmlTextWriter(myTextWriter)
Exceldg.RenderControl(myHtmlTextWriter)
Response.Write(myTextWriter.ToString())
Response.End()
when i remove the line Response.AddHeader("Content-Disposition", "attachment;filename=Wells.xls")
it just opens the excel inside the browser without errors, so i'm guessing error is from that line for some unknown (to me) reason
|
|
|
|
|
Solved it myself, posting solution for others:
I had and needed this on top of my page
Response.CacheControl = "no-cache"
(Or it wouldn't show last added items..)
Had to remove that line to get the excel thing working...
And to solve the display thing, I just sent a unique new id for each time a record was added (open aaa.aspx?id="& newID &" instead of open aaa.aspx))
|
|
|
|
|
hi,
I want to use the dateTimePicker control in VB.net,with the format dd/MM/yyyy, but I want the cursor to move from dd, to MM then to yyyy,directly while changing the value, so that the user don't have to move with the left arrow.
can anybody help me, please
Regards.
MK
|
|
|
|
|
I need to simulate a mouse click by pressing a button on the keyboard, the button part is fine, i just need to know how to make the mouse click without user input. I would Preferably like to acheive this without the use of APIs, as i dont quite understand how to use them properly.
Help Appreciated! Thanks in advance.
Posted by The ANZAC
|
|
|
|