|
Hi Guys,
I have a combobox on a form. As soon as I click on the combobox I am unable to get out of it. The combobox shows me all the data it should, but I am unable to exit the control once selected. I can select any value, and do it any number of times however any attempt to close the form, click on another control in the form, etc fails. The only way out is to stop the debugger. No errors are issued.
I've spent an entire day tryin to find the problem and can't. I'd appreciate any ideas please.
The datasource is a very simple dataset (dsCorrespondenceMethods) containing a single table (CorrespondenceMethods). This table contains only 2 columns - an ID column and a description column. The table just contains a list of methods of corresponding such as "Email", "Fax", "Post", etc. I've put it into a table just to make any future changes simple and not require recoding of the app.
Thanks in advance
Mark
|
|
|
|
|
Are you doing any validation anywhere on the form??
I can't replicate the problem, nor can I find any occurances of it.
|
|
|
|
|
Thanks for responding Dave.
No validation yet. I've put together this form and not being experienced it has taken me days so I'm trying not to start again.
The source is a simple DS/table. It saves back to another DS for the client.
IF I remove the "Selected Value" from the combobox (so it has nowhere to save back to) the problem still occurs. This means the only thing on the combo box is the bound items to display the list.
In an attempt to replicate the behaviour and see if it was the dataset, I created a new form and put a combobox and a textbox onto the form. All worked nicely......so I am still lost...
|
|
|
|
|
Since you've been tinkering with this for so long, it sounds like there might be a screw up in the designer generated code. I'd recommend removing that ComboBox and re-adding a new one, setting it's properties to what you need, and see what happens.
|
|
|
|
|
Good to see we are thinking on the same lines. I already tried it after I responded last, and it resolved the problem with one of the combo boxes but not the second one I am having problems with....but at least it is a start.
Many thanks for your help.
MArk
|
|
|
|
|
Hello Friends ,
I am creating mail system in window based application .we are using
richtextbox for writing msgbody and also inserting image in
msgbody .Text is sending but image is not sending plz help
me. Sending button code metion here .
Dim mailmsg As New MailMessage
mailmsg.To = Me.TextBox1.Text
mailmsg.Cc = Me.TextBox2.Text
mailmsg.Subject = Me.TextBox3.Text
mailmsg.From = "Test"
mailmsg.Body = Me.RichTextBox1.Text
Mail.SmtpMail.Send(mailmsg)
Manu
-- modified at 7:38 Tuesday 18th September, 2007
|
|
|
|
|
I haven't tried using this technique, but a little searching of the articles here on CP revealed this little article[^].
|
|
|
|
|
Hi all
I need some thing like this
Open a word file read it, delete all the tables in it, save it.
1)So a browse button to select a word file.
2)a button called delete( code to delete all table inside the word file)
3) save it.
Prakash Mishra(Banglore,India)
|
|
|
|
|
Good Morning everybody, I am awfully new to posting on the code project website, so please go gently with me.
I am trying to figure out how to add sub sub menues to a menu programatically. I have the menu set up as follows
File.......Options......Play
=================================
Open.......Prefs.......Play DVD
Exit
Now after the program runs, I wish to add a Sub Menu to PLAY DVD, how could i accomplish this?
hope everyone reading this understands what i am trying to accheive
|
|
|
|
|
you can give a name to the toolstripmenuitem (play dvd) (for further reference I'll name it DVD;P)
then you can simply add one like this
Dim mnuunderdvd As New ToolStripMenuItem("underDVD")
AddHandler mnuunderdvd.Click, AddressOf mnuunderdvd_Click
DVD.DropDownItems.add(mnuunderdvd)
in mnuunderdvd_click you put the code that needs to run when the user clicks it
hope this helps
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Thank you that's great, how do i implement the Handler to handle the click event of the newley created item.
Sorry for such ignorance, but I am quite nwe to VB.Net
|
|
|
|
|
the handler is a normal methode wich would look like this:
Private Sub mnuunderdvd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
TDDragon wrote: the handler is a normal methode wich would look like this:
Private Sub mnuunderdvd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Thank you. Another query if I may.
I suppose there is no way around adding Handlers programatically as this is what i will be requiring.
My Form1.Load event call a sub routine as follows
Load_Menus()
then my sub routine is as follows
Public sub Load_Menus()<br />
<br />
For Each drive As DriveInfo In My.Computer.FileSystem.Drives<br />
<br />
If drive.DriveType = DriveType.CDRom Then<br />
<br />
Dim PlayDvd As New ToolStripMenuItem<br />
PlayDvd.Text = drive.Name<br />
Me.dvdMenuItem.DropDownItems.Add(PlayDvd)<br />
<br />
else<br />
End If<br />
<br />
next<br />
end sub
so i want to loop through all available CD-Drives on the system and if it finds one then add it to the menu under DVD.
But if it was to find several cd drives, how would i add a handler for each one found
|
|
|
|
|
just add the addhandler inside the for loop
and then in the mnuunderdvd_click methode you'll need to check wich one is clicked
the sender object contains the clicked toolstripitem so if you do
dim mnu as toolstripmenuitem = sender
you can compare the text property of mnu or if you can add something (like the drive path/letter) to the tag property of the toolstripitem inside you for loop (in the load) and then compare this tag or use this tag to access the drive inside the mnuunderdvd_click methode
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Could I get around this by putting this in a single handler for all
Dim Drive_To_Read_DVD_From as string = sender.tostring
'' result being for example drive_to_read_DVD_From equaling D:\
then take it form there
|
|
|
|
|
see earlier post but I would store the drive path/letter in the tag property that way you can just use that value without altering it
also you need to cast the sender to toolstripmenuitem before you can access its property's
sender.tostring will just get you the type and somemore
so:
dim mnu as toolstripmenuitem = sender
mnu.text = 'text from the toolstripmenuitem clicked
mnu.tag = ' the tag property from the toolstripmenuitem clicked
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Hello,
Although I am not very clear about the scenario, I would like to inform you that we may create new menu items as ToolStripMenuItem object, and this item can be added as a sub menu to any existing ToolStripMenuItem using following code –
Dim PlayDvd As New ToolStripMenuItem
PlayDvd.Text = "New File"
Me.OpenToolStripMenuItem.DropDownItems.Add(PlayDvd)
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
can we write a code in vb which is equivalent to control c keyboad action, If yes pl provide me the code
Prakash Mishra(Banglore,India)
|
|
|
|
|
'Set form1 keypreview property to true'
'Add 2 labels
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.Control And e.KeyCode = Keys.C Then
Clipboard.Clear()
Clipboard.SetText(label1.text)
End If
If e.Control And e.KeyCode = Keys.V Then
Label2.Text = Clipboard.GetText()
End If
End Sub
Shay Noy
|
|
|
|
|
you want to copy certain text I presume.
this will usualy work without any code (if windows is the OS)
if you want another action to happen you'll need to catch the keydown event and check wether the control key and the c key are pressed.
Another way (perhaps better/easier) is to add a menustrip to you'r form (put it invisible)
and then in code (or design):
Dim mnuselectie As New ToolStripMenuItem("selectie")
mnuselectie.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.C), System.Windows.Forms.Keys)
AddHandler mnuselectie.Click, AddressOf mnuselectie_Click
msAlgemeen.Items.Add(mnuselectie) 'msalgemeen=menustrip on the form
then add code to mnuselectie_click
hope this helps
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
hi
I want to perform a the action like
1) select a file.
2)click the button ( here i want to perform 3 actions CntrlA + CntrlC + CntrlV) that is select all + Copy + Paste.
3) The output will get paste in a specified word file.
So i want on a button click these 3 action to get performed. Pl help
Prakash Mishra(Banglore,India)
|
|
|
|
|
I'll need a bit more information to answer this
the file is in wich format??
the file is on the hdd and you select it in you're programme or just in windows explorer??
the word file is specified in you're programme??
all the actions have to perform in sequence without any further user input??
you work with a button or a shortcut??
once the button is pressed you know the filepath and the word path??
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
thanks lot for your patience.
1)the action ( CntolA + ControlC) i want o perform on a pdf file
2)I want to create a browse button which will give the path of the pdf file)I think i have to open the file before performing the CntolA + ControlC action.
3)Then the i want a button say the name is action ( which will perform the events sequentially select all(pdf) + Copy + Paste(in word)
Hope i am clear to u this time
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
|
hi friend,
i have a big problem which i dont know how to solve it,, it say's when i run the application "parameter is not valid"..and i look the error details that vb.net raise it about system.drawing.stream i run in visual studio .net 2005 i made it in vb.net then i deploy it to another laptop which is vaio model and windows xp prof. version 2002 sp 2 and it coz error..how can i fix that..is there a way to fix the problem...here's my code..
Public Sub LOAD_PICTURE_FROM_DBASE(ByVal i As String)
'Dim myconnection As New SqlConnection(My.Settings.CNString)
'Dim cmd As New SqlCommand("SELECT BLOBID, " & _
'"BLOBData FROM BLOBTest WHERE BLOBID=", DataGridView1.CurrentRow.Cells(0).Value)
Dim appRdr As New System.Configuration.AppSettingsReader
Dim myconnection As New Clsappconfiguration
'Dim myconnection As New SqlConnection(My.Settings.CNString)
Dim cmd As New SqlCommand
Dim da As New SqlDataAdapter
Dim ds As New DataSet
cmd.CommandText = "select * from Temployee_picture where idnumber=" & "'" & i & "'" 'i & "'"
cmd.CommandType = CommandType.Text
cmd.Connection = myconnection.sqlconn
myconnection.sqlconn.Open()
da.SelectCommand = cmd
da.Fill(ds, "Temployee_picture")
Dim c As Integer = ds.Tables("Temployee_picture").Rows.Count
If c > 0 Then
Dim bytBLOBData() As Byte = _
ds.Tables("Temployee_picture").Rows(c - 1)("picturedata")
Dim stmBLOBData As New MemoryStream(bytBLOBData)
emp_pic.Image = Image.FromStream(stmBLOBData)
Else
emp_pic.ImageLocation = Application.StartupPath & "\SplashScreen v3.jpg"
emp_pic.Load()
End If
myconnection.sqlconn.Close()
End Sub
that's the code that load picture from database...please reply me how to solve the this problem..parameter is not valid...
jhols
|
|
|
|