|
Where is this code?? Is it on your Form or is it part of a custom ComboBox control?? This code has to be part of a custom ComboBox to work.
You got it mostly right. Though, your Select Case is really messed up. You don't need the Select Case True . That will ALWAYS execute it's code no matter what. All you want is to NOT process MouseWheel messages. All other MUST be passed to the base ComboBox control. Soooo....
Public Class MyComboBox
Inherits ComboBox
Private Const WM_MOUSEWHEEL As Integer = &H20A
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case WM_MOUSEWHEEL
' If we see a MouseWheel message, do not process it!
Exit Sub
End Select
' All other messages get processed as normal.
MyBase.WndProc(m)
End Sub
End Class
... is what you're looking for.
|
|
|
|
|
I sure was hoping it was easier but no biggie. Ive dont a few custom controls in my day... .
That select true used to contain code by the way but I was still in the middle of messing with it.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
I start a new job and my boss ask me if I can write the program to print the bar code label. Any one can help me out. Thanks.
Linh do
dolinh25@yahoo.com
|
|
|
|
|
There are numerous fonts that contain the 3 of 9 bars. WASP also has a barcode font and assembly in .NET.
I would recommend searching Google for a solution that meets your needs.
|
|
|
|
|
I have a variable on another form that I need to read and write to. I know it'll be obvious once someone tells me...
Just for the record, the form with the variable I'm trying to access is frmMainTools and the one I'm trying to access from is frmMain.
A timely answer would be most helpful. Thanks!
---------------------------------------
If it ain't broke, you're not tryin'!
|
|
|
|
|
The easiest method is to declare the variable on frmMainTools as public.
|
|
|
|
|
Dim mCurrentForm As Form
How would one make that public when it is already declared as a Form?
|
|
|
|
|
Looks like I got it figured. Thanks for the help and speedy responses.
The fact that this is going to be an app for just this company and it's a rather small app causes me to not worry about messy code. It doesn't need to work fast and besides that, it's only a database front-end, so I'm not going to be too worried if it breaks.
Thanks again!
--------------------------------
If it ain't broke, break it!
|
|
|
|
|
Maybe the easiest, but not the best in terms of OOP. Globals are not good
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
The best way to do this is to set up a delegate between the forms that fires the value across when it is changed. This is far cleaner than making variables public.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
While I was running a vb.net application in a local drive, the application was runnig fine. But as soon as I tried to work with the same application on a network drive, I was facing the following error.
Request of the permission of tyepe 'System.Data.oledeb.oledbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Please anybody help me to solve this problem.
with regards
vishal
|
|
|
|
|
Code running from any non-local source is, by default, not trusted. Therefor, it runs in a restricted sandbox that has permissions to just about nothing. If you're going to be running code from non-local sources, i.e.: ANY network source, share, whatever, ..., you're going to have to understand Code Access Security[^].
|
|
|
|
|
hi all
i m working on a word pad like application and i place a ruler on and need to place the slider of the ruler.
does someone has any kind of idea about the work
if yes then plz tell me
|
|
|
|
|
history:
I need to put shortcut key's on a button (is actually a label that I draw myself and that acts as a button)
My first idea was to put '&' before the desired letter (didn't work)
My second idea was to catch the keydown event of the form and check for myself witch button was pressed and act appropratly (after a bit fiddling got it to work pretty nice)
then I noticed as soon as I opened another form (in the mdiparent where I catch the keydown event) the keydown didn't get triggerd (now I know that is normal beceause the new form has the focus) so I put the property 'Keypreview' on true and quess what everything worked again.
Information:
in the project we are working on, we are using datawindows to display the data from the db in a grid or editable form (for those that don't know what datawindows is: its a 'component' that you create outside of visual studio and then can use in visual studio without much programming (has an access feel to it (I'v only been using it for a week now so not that good at it yet))).
Problem:
When I put the fields on the datawindow on editable and the cursur is in such a field the shortcuts don't work anymore but when the fields aren't editable they do work ofcourse this isn't really what we want (shortcuts that work only a small part of the time)
Additional information:
I have shortcutkeys that remain the same over the entire project (mdiparent level) and shortcutkeys that are form specific.
Anyone have any idea why I have this problem?
|
|
|
|
|
Hi all,
I have a windows form that contains a listview and a contextmenu. The form is splitted with a splitter control. In load event the data will be populated in the list view. When we activate menu the menuitems will be dispalyed like Add, Edit, Delete..
My problem is , if the user clicks a region which data is not present, ie. suppose the list view contains 3 rows, remaing white space will be there, when the user clicks that white space , the menu should not be displayed.
Now context menu will be displayed whenever user right clicks the mouse.
I want to display context menu only if the user clicks a row in the list view. Please help me to do this...
Thanks in advance
Sebastian
|
|
|
|
|
Hi there,
I've just wrote my first webservice with VB.NET. If I want to get back strings or integers as return values everything works fine, but when I try to get an array back, there is something wrong. Maybe you can take a look at the code:
Public Class DirectoryInformation<br />
Public Name As String<br />
End Class<br />
<WebMethod()> _<br />
Public Function fncGetAllFilebin(ByVal VirtualPath As String)<br />
Dim di As New DirectoryInfo(WebServerPath & VirtualPath)<br />
Dim diArr As DirectoryInfo() = di.GetDirectories<br />
Dim dri As DirectoryInfo<br />
Dim x As Integer = 0<br />
Dim Arr As DirectoryInformation()<br />
ReDim Preserve Arr(di.GetDirectories.Length - 1)<br />
For Each dri In diArr<br />
Arr(x) = New DirectoryInformation()<br />
Arr(x).Name = dri.Name<br />
x += 1<br />
Next<br />
Return Arr<br />
End Function
The error i get is:
"System.Web.Services.Protocols.SoapException" ist in System.Web.Services.dll
System.Web.Services.Protocols.SoapException: Die Anforderung konnte vom Server nicht verarbeitet werden. ---> System.InvalidOperationException: Beim Generieren des XML-Dokuments ist ein Fehler aufgetreten. ---> System.InvalidOperationException: Der Typ whsEasyDoc.Service1+DirectoryInformation[] kann in diesem Kontext nicht verwendet werden.
bei System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
bei Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
bei Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write8_fncGetAllFilebinResponse(Object[] p)
bei Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer13.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
bei System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
bei System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
bei System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
bei System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
bei System.Web.Services.Protocols.WebServiceHandler.Invoke()
--- Ende der internen Ausnahmestapelüberwachung ---
Thanks,
Christoph
|
|
|
|
|
My German isn't very good, but I am pretty sure your problem has to do with what you are trying to return. In general you can return specific types from a webservice if they are properly defined there. Otherwise a web service only returns standard types like Int32, String, Boolean and a DataSet. So I would suggest perhaps you change your array into a DataSet and I think your error will go away.
Hope that helps.
Ben
|
|
|
|
|
Thanks Ben,
I've tried the DataSet and it works fine for me.
See you
Christoph
|
|
|
|
|
hi All the Following code reside on my Search Button.i want to search the results in datagrid(dataset),using the input from a textbox. and return the results if found. am usng SQl. here is the code i tried write , please help me fix this .
'Open Database Connection
Dim strconnection As String = "workstation id=5875-049;packet size=4096;user id=***; Password=******;data source=S*******;persist security info=False;initial catalog=Tshwane_Valuations"
Dim cn As SqlConnection = New SqlConnection(strconnection)
cn.Open()
'set up data adapter
Dim strSql As String = _
"select Actual_Extent,Attrib_code,Lis_key,Func_key,Density," _
& "New_Net_Usable_Extent,New_Total_Land_Factor,New_AdJ_Extent_1,New_Points_1," _
& "New_ADJ_Extent_2, New_Points_2, LS_Prediction, LS_Confidence,LS_TYPE from Property_Mass "
Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn)
'load Dataset
Dim ds As DataSet = New DataSet
da.Fill(ds, "Property_Summary")
'Set up a new Data adapter Object
strSql = "select Property_Mass.Actual_Extent,Property_Mass.Attrib_code,Property_Mass.Lis_key,Property_Mass.Func_key,Property_Mass.Density," _
& " Property_Mass.New_Net_Usable_Extent,Property_Mass.New_Total_Land_Factor,Property_Mass.New_AdJ_Extent_1, Property_Mass.New_Points_1," _
& " Property_Mass.New_ADJ_Extent_2, Property_Mass.New_Points_2, Property_Mass.LS_Prediction, Property_Mass.LS_Confidence, Property_Mass.LS_TYPE," _
& " Property_Summary.Purchase_Date, Property_Summary.Purchase_Price" _
& " from Property_Mass, Property_Summary" _
& "where Substring(Lis_key,1,4)= ?"
da.SelectCommand.Parameters("Lis_key").Value = txtliskeysearch.Text
da.Fill(ds)
If ds.Tables("Property_Mass").Rows.Count = 0 Then
MessageBox.Show("Township not Found")
End If
End Sub
When i run this code it gives me an Error
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.data.dll
Additional information: An SqlParameter with ParameterName 'Lis_key' is not contained by this SqlParameterCollection.
And points to the Following line
da.SelectCommand.Parameters("Lis_key").Value = txtliskeysearch.Text
Help
Thanks
Thanks
Vuyiswa Maseko
|
|
|
|
|
|
Hi,
I am still working with VB.NET 1.1.
I have the following in my page load:
Private Sub Page_Load
If Not Page.IsPostBack Then
ViewState("ContainsSearch") = "Text 1"
End If
Response.Write("ViewState(ContainsSearch) = " & ViewState("ContainsSearch"))
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSearch.Click
ViewState("ContainsSearch") = "Text 2"
End Sub
When the page loads for the first time it displays Text 1. When I click the button it still displays Text 1. When I press F5, then it only displays Text 2. How can I get it to display Text 2 when I click the button because the view state value is supposed to change when I click the button.
Regards,
ma se
|
|
|
|
|
I'm no ASP.NET expert, and this question belongs in the ASP.NET forum, not the VB.NET or C# forums, but...
ViewState is a property bag for server controls acrossed page requests. This is where controls store their values when they need to be retrieved by the next request of the page. Though, I have no idea if it'll work for a Form like you're trying to use it.
|
|
|
|
|
hi everyone
i needed to write xml as follows
<employee>
<empcode>100</empcode>
<name>bb</name>
<hobbies>
<data>reading</data>
<data>listening music</data>
</hobbies>
</employee>
my employee database table is seperate and hobbeis table is separate and
they are related by emp_code which acts as a foreign key in other table
so using writexml method i need to write from the adapter.
i think i needed to do some changes in joining the table
if u have a idea how to do please explain
|
|
|
|
|
You'll have to write the code to serialize this yourself. The standard serializer will treat each table seperatly and not embed the data from one table into the rows of the other.
|
|
|
|
|
Hi,
I have two questions:
a) How can you prevent an MDI parent form from displaying scroll bars?
b) I am using a webbrowser control which is supposed to carry out a few actions once the document has been loaded and displayed. I am writing the code in the Document_Completed event but to my surprise, it carries it out before the document has been displayed (I am actually trying to take a screenshot of the loaded page, and it ends up taking it before it has completly loaded :S). Any Ideas?
Thanks,
Ahmad
|
|
|
|
|