|
Your talking about locking your application if it sits idle too long?
This is better left up to the O/S... But...
Look into the Application.Idle[^] event. You can start a Timer when this event fires. You'll also have to handle the MouseMove and KeyDown events for your form to stop this Timer. When the Timer's Tick or Elapsed event fires, you can "lock" your app however you want.
But, like I said, this is better left up to the O/S because if your app is idle while the user is using another app, it'll lock your app and make it a pain if the a$$ for the user to unlock your app when they expect it to be working, and unlocked, like every one windows app they have running at the same time.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can anyone give me the difference between the use of implements and the use of inherits
thanks in advance
Assaf
|
|
|
|
|
inherits is used for class inheritance, implements for interface inheritance.
The differences are:
1) A Class may only inherit from one base class
2) A Class may implement many interfaces.
-- modified at 6:44 Friday 24th March, 2006
|
|
|
|
|
Hi
Inherits(Inheritence) is used when you want to write a new class by taking(Inheriting) the functionality provided by an already existing class. By inheriting, you can enhance(override) a function in the derived class.
"Implements" is implementing a given functionality.Here you write the code from scratch.You only have a method declaration and not definition.
To summarize, inheritance is for a class and "implements" is for a interface.
Raghavendra
|
|
|
|
|
Hello
I have added horizontal scroll bar to a combo in VB.NET by calling SendMessage(ComboBox1.Handle, CB_SETHORIZONTALEXTENT, 1000, 0), but the scroll bar does not appear. Also I want to add a tooltip for the highlighted item in a dropdown but i dont have a event on listbox portion of a combo.
Please help.
Thanks
Raghavendra
|
|
|
|
|
raoraya wrote: I have added horizontal scroll bar to a combo in VB.NET by calling SendMessage(ComboBox1.Handle, CB_SETHORIZONTALEXTENT, 1000, 0),
That doesn't add a horizontal scrollbar. It just sets the extent to which it can scroll IF one was visible. The ComboBox has to be created with a WS_HSCROLL style bit set, upon its creation, in order for a horizontal scrollbar to show up, but the .NET control isn't created with this bit set.
In order to do this, you'll have to create your version of the ComboBox class by inheriting from ComboBox and overriding a couple of things. This should get you started...
Public Class ComboBoxEx ' or whatever you want to call your version
Inherits ComboBox
Private Declare Auto Function SendMessage Lib "user32" ( _
ByVal hWnd As IntPtr, ByVal Msg As Integer, _
ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
Private Const CB_SETHORIZONTALEXTENT As Integer = &H15E
Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.Style = cp.Style Or &H100000 ' This turns on the WS_HSCROLL bit.
Return cp
End Get
End Property
Protected Overrides Sub OnDropDown(ByVal e As System.EventArgs)
' You might want to add some code to figure out how long the longest item is first!
SendMessage(MyBase.Handle, CB_SETHORIZONTALEXTENT, widthInPixels, 0)
MyBase.OnPaint(e)
End Sub
End Class
raoraya wrote: Also I want to add a tooltip for the highlighted item in a dropdown but i dont have a event on listbox portion of a combo.
Using the standard control, there is no way to determine which item the mouse is hovering over, therefore, no way to put up a meaningful tooltip on a per-item basis. You'd have to create your own version of the ComboBox that exposes this. I've seen examples in C++ and MFC that do this, but nothing for C# or VB.NET.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you very much.
I am able to get the highlighted item in a combo box by using SendMessage(ComboBox1.Handle, CB_GETCURSEL, 0&, 0&). But I dont have an event fired when the mouse moves over the list box portion of combo box. Is there a way to do it?
|
|
|
|
|
raoraya wrote: But I dont have an event fired when the mouse moves over the list box portion of combo box. Is there a way to do it?
There is no event for this. Also, you'd have to write, from scratch, your own ComboBox if you wanted to add ToolTip on a per-item basis. I have never found and VB.NET or C# code to do this. I have found, however, C++/MFC code. This MIGHT be able to be used as a model, but I think it's WAY too much work for little functionality.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I worked on a project where we scanned barcodes on corrugate containers (cardboard boxes). The barcodes were printed on line by a Marsh printer. The barcode reader was connected to Channel "0" of an AB PLC 5/40. In the ladder logic I picked apart the barcode to only have the last 6 digits. These digits are brand specific. Then I compared these digits with the digits that came down from the mainframe when the operators selected the brand that they were running. If there was a mismatch, the line was shutdown. There is a function in the PLC 5 that lets you read directly from Channel "0". It has been a few years since I have worked on that logic, so things are a little fuzzy!
email: duyquang200384@yahoo.com
email: duyquang200384@yahoo.com
|
|
|
|
|
I fail to see the VB.NET question in here. From you post, it looks like your asking a ladder logic question....this ain't the place for it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am to create reports but not able to deploy it .I get the error
The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
How to solve this
|
|
|
|
|
What report server?? What are you using to generate reports?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i need to update the database from the datagrid
the error that im getting is:
Additional information: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
my code to populate the datagrid is:
Dim i As Integer
Me.DataSet11.Clear()
sqldate = "Select FORMAT(Login , 'hh:nn') as [LOGIN TIME], FORMAT(Logout, 'hh:nn') as [LOGOUT TIME], FORMAT(Dater, 'yyyy/mm/dd') as [Office Date], Overtime, (DateDiff('n', LOGIN, LOGOUT) / 60) - 1 AS [Total Hours], (DateDiff('n', LOGIN, LOGOUT) / 60) - 1 - 8 AS [Excess Hours], (DateDiff('n', FORMAT('9:00', 'hh:nn'), LOGIN) / 60) AS [Late], (DateDiff('n', FORMAT('9:00', 'hh:nn'), LOGIN) / 60) / 0.25 AS [Late in 15 min] from tblTime where IDNo = '" & idn & "' and FORMAT(Dater, 'yyyy/mm/dd') BETWEEN FORMAT('" & d1 & "', 'yyyy/mm/dd') AND FORMAT('" & d2 & "', 'yyyy/mm/dd') Order by Dater Asc" '
Me.OleDbDataAdapter1.SelectCommand.CommandText = sqldate
Me.OleDbDataAdapter1.Fill(Me.DataSet11, "tblTime")
Me.DataGrid1.SetDataBinding(Me.DataSet11, "tblTime")
and my code to update the fields:
If Me.DataSet11.HasChanges Then
Dim sda As New OleDbDataAdapter
Dim scb As New OleDbCommandBuilder
sqldate = "Select FORMAT(Login , 'hh:nn') as [LOGIN TIME], FORMAT(Logout, 'hh:nn') as [LOGOUT TIME], FORMAT(Dater, 'yyyy/mm/dd') as [Office Date], Overtime, (DateDiff('n', LOGIN, LOGOUT) / 60) - 1 AS [Total Hours], (DateDiff('n', LOGIN, LOGOUT) / 60) - 1 - 8 AS [Excess Hours], (DateDiff('n', FORMAT('9:00', 'hh:nn'), LOGIN) / 60) AS [Late], (DateDiff('n', FORMAT('9:00', 'hh:nn'), LOGIN) / 60) / 0.25 AS [Late in 15 min] from tblTime where IDNo = '" & idn & "' and FORMAT(Dater, 'yyyy/mm/dd') BETWEEN FORMAT('" & par & "', 'yyyy/mm/dd') AND FORMAT('" & par2 & "', 'yyyy/mm/dd') Order by Dater Asc" '
sda = New OleDbDataAdapter(sqldate, DBASE.con)
scb = New OleDbCommandBuilder(sda)
sda.Update(Me.DataSet11, "tblTime")
End If
|
|
|
|
|
additional and when i change the select statement wherein i include the primary key the error is = Additional information: Concurrency violation: the UpdateCommand affected 0 records.
the code wherein i change the select statment, i include the primary key IDTime....
If Me.DataSet11.HasChanges Then
Dim sda As New OleDbDataAdapter
Dim scb As New OleDbCommandBuilder
sqldate = "Select IDTime, FORMAT(Login , 'hh:nn') as [LOGIN TIME], FORMAT(Logout, 'hh:nn') as [LOGOUT TIME], FORMAT(Dater, 'yyyy/mm/dd') as [Office Date], Overtime, (DateDiff('n', LOGIN, LOGOUT) / 60) - 1 AS [Total Hours], (DateDiff('n', LOGIN, LOGOUT) / 60) - 1 - 8 AS [Excess Hours], (DateDiff('n', FORMAT('9:00', 'hh:nn'), LOGIN) / 60) AS [Late], (DateDiff('n', FORMAT('9:00', 'hh:nn'), LOGIN) / 60) / 0.25 AS [Late in 15 min] from tblTime where IDNo = '" & idn & "' and FORMAT(Dater, 'yyyy/mm/dd') BETWEEN FORMAT('" & par & "', 'yyyy/mm/dd') AND FORMAT('" & par2 & "', 'yyyy/mm/dd') Order by Dater Asc" '
sda = New OleDbDataAdapter(sqldate, DBASE.con)
scb = New OleDbCommandBuilder(sda)
sda.Update(Me.DataSet11, "tblTime")
End If
|
|
|
|
|
i am using Ms Access Forms at front end and Ms ACCESS database at backend , i want to know how i can connect buttons of Ms Acees Forms with MS ACESS database ? can some one help me ?
Farooq Azam
|
|
|
|
|
Ummm. Exactly what are you trying to do? What do you mean by "connect buttons"? Which version of Access?
|
|
|
|
|
Hi,
I want to build a small prog. that can using mouse to draw line in a pictureBox. After that, i can use the pictureBox.image to save or transfer it to a bitmap object..
How can i do this?
Thanks for your help!
|
|
|
|
|
look at this thread
http://www.codeproject.com/script/comments/forums.asp?msg=1419622&forumid=1646#xx1419622xx
"If i was king cigarettes would be free."
|
|
|
|
|
Thanks, hope i found my answer!
|
|
|
|
|
I am trying to develop a win app where i am creating reports
I want to add/remove database/tables through coding.
So Anybody can help me Plz.
Ash R.
-- modified at 23:31 Thursday 23rd March, 2006
|
|
|
|
|
Yes you can do it, if you have Access at frontend and Access db at backend then you can run wizard to do so.
Regards
|
|
|
|
|
Hi Sajid. Thanks.
But Situation here is i have MYSQL as backend and vb.net as frontend.
And I want to add/remove database/tables from crystal reports at runtime
using vb.net coding.
Ash. R.
|
|
|
|
|
Hi,
I have a table with ID, col_name1, col_name2 and so on.
i am building a dataTable with ID
another datatable with all the columns that contains that id
now i am passing ID as a parameter in the second datalist and building a dataview. which gives me a block of data with just one specific ID. please refer to my code below:
-----------------------------
objConn = New SqlConnection(dbPath)
Try
'select the table with only distinct ID based
cmd = New SqlCommand("select distinct measure_id from measuredata m, textdata t where t.ScoreCardId = m.ScoreCardId", objConn)
Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dtId As New DataTable("MeasureId")
da.Fill(dtId)
'select all columns with ID
Dim cmd1 As SqlCommand = New SqlCommand("select * from measureData", objConn)
Dim da1 As SqlDataAdapter = New SqlDataAdapter(cmd1)
Dim dt As New DataTable("MeasureSource")
da1.Fill(dt)
Dim myView As New DataView(dt)
Dim datarow As DataRow
Dim listitem As System.Web.UI.WebControls.ListItem
For Each datarow In dtId.Rows
myView.RowFilter = String.Format("Measure_Id='{0}'", datarow.Item("measure_Id"))
'######## checking if the dataview works #########
DataGrid1.DataSource = myView
DataGrid1.DataBind()
Next datarow
Catch ex As Exception
Response.Write("OOPs what went wrong:" + ex.ToString)
Finally
End Try
-----------------------------
now Datagrid1 is picking up only the block of record with last ID as it can only hold i set of data.
how can i programatically populate a chart inside that loop so that i can build a chart if there is data related to specific ID.
my aim is to generate a separate webchart for each ID in run time. do i need to declare those webchart control before i actually bind the data to it.
hope its not complex. I did post this question lots of time but i am not getting any response. is it too hard? I am happy to buy a third party software if could automate what i want to achieve.
many thanks again for all your help.
|
|
|
|
|
Hi all,
I want to have the drop down items from a main menustrip item appear in a
context menu. I must be missing something because the only way I can see to
do this is to manually duplicate the menu items in the contextmenustrip and
duplicate the code to handle the click event.
I have tried the Contextmenustrip.Items.AddRange(Toolstripmenuitem.Dropdownitems) but this seems to move the menu item to the context menu and crashes if there are more than 1 Toolstripmenuitem.Dropdownitems.
In VS 2003 you could merge a main menu items into a context menu, nice and
easy. Couldn't find any help searching the forums, surely I am not the only
one trying to do this?
Also, is it true that MS has not implemented visual inheritance for menustrips on forms? I can no longer add to/merge with the menu that appears on the ancestor on an inherited form!!
Any assistance greatly appreciated
Derek Chong
University Of Melbourne
Fire and Forest Simulations
|
|
|
|
|
I am using the following code to save an image into an MSAcess database using VB 2003
How can I resize the image to a fixed size? and two is there a cleaner way to do this
Dim STREAM As System.IO.FileStream
Dim READER As StreamReader
Dim JPEG_FILE As String
JPEG_FILE = txtPicFile.Text 'this is the path and file name of image
STREAM = New FileStream(JPEG_FILE, FileMode.Open, FileAccess.Read, FileShare.Read)
READER = New StreamReader(STREAM)
Dim FILEBYTE(STREAM.Length - 1) As Byte
STREAM.Read(FILEBYTE, 0, STREAM.Length)
'save image to database using DBS As DAO.Database and RST As DAO.Recordset...
.Fields("Image").Value = FILEBYTE
|
|
|
|
|