|
Do you have a file called licenses.licx floating about ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How can i increment current cell by adding one to it.
Its vb equivalent is grid.col = grid.col+1
|
|
|
|
|
What sort of container are you using ? A datagrid has a Columns collection, which is numerically indexed, and also by column name.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Dim temp As Integer
temp = 5 / 2 : output = 2
temp = 11/ 2 : output = 6 <- ??
(5/2=2,11/2=5)
why?
|
|
|
|
|
Because you defined temp as an Integer. 11/2 = 5.5, or as an integer, 5. Converting a floating point number to an integer truncates the decimal point and everything after it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Because it's rounding up, if you want it to always round down, use Math.Floor
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
On 5/2 = 2.5 ==> 2 it is rounded down
On 11/2 = 5.5 ==> 6 it is rounded up
I don't know why, but it is alternating rounding up and down... 3.5->4 4.5->4 ...
|
|
|
|
|
Hi,
is it possible to execute code, saved in a string, while runtime? The Problem is the access to the controls on my Forms. It is for a language-system. I've the controls including property in a String (e.g. "frmMain.cmdEnd.Text") and the target value in another string. How can i access the property of the target control?
Thanks, schachmat
|
|
|
|
|
You can use reflection to find the control and it's property and set it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Can you give me an example please?
Thanks, schachmat
|
|
|
|
|
Not really, I don't write VB.NET, I'm here only because most questions end up being framework related. But if you google, you'll find lots of examples.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I only need the right class/methods... (Or some search-phrases for google...)
Thanks, schachmat
-- modified at 3:57 Friday 22nd September, 2006
|
|
|
|
|
__Dim InfoMember As System.Reflection.MemberInfo
__Dim InfoProperty As System.Reflection.PropertyInfo
__
__For i As Int32 = 1 To Anzahl
____Dim Target As String = (...)
____Dim Value As String = (...)
____Dim Memberr() As String = Split(Target, ".")
____InfoMember = My.Forms.GetType.GetMember(Memberr(0))(0)
____For j As Int16 = 1 To Memberr.Length - 2
______InfoMember = InfoMember.GetType.GetMember(Memberr(j))(0)
____Next j
____InfoProperty = InfoMember.GetType.GetProperty(Memberr(Memberr.Length - 1))
____InfoProperty.SetValue(InfoMember, Value, Nothing)
__Next
This is, what i have coded until now. But there is still an Error inside: InfoMember.GetType doesn't get me the Type of the Member, but gets me the Type "MemberInfo". Now how can i get the Type of the Member, saved in InfoMember??
Thanks, schachmat
|
|
|
|
|
__Dim InfoMember As System.Reflection.MemberInfo
__Dim InfoProperty As System.Reflection.PropertyInfo
__
__For i As Int32 = 1 To Anzahl
____Dim Target As String = (...)
____Dim Value As String = (...)
____Dim Memberr() As String = Split(Target, ".")
____InfoMember = My.Forms.GetType.GetMember(Memberr(0))(0)
____For j As Int16 = 1 To Memberr.Length - 2
______InfoMember = Type.GetType(Split(InfoMember.ToString, " ")(0), True, False).GetMember(Memberr(j))(0)
____Next j
____InfoProperty = Type.GetType(Split(InfoMember.ToString, " ")(0), True, False).GetProperty(Memberr(Memberr.Length - 1))
____InfoProperty.SetValue(InfoMember, Value, Nothing)
__Next
I solved the Problem (blue), but got another one (red): InfoMember isn't right. I need the Member (e.g. My.Forms.frmMain) and not the MemberInfo-structure about it. How can i get the member out of the MemberInfo-structure?
Thanks, schachmat
|
|
|
|
|
Hello and good day
Windows XP Professional allows for "locking" of a computer as opposed to logging out or shutting down. Currently, the network I am on has no Event Sync for this practice whereas it does have them for Logon and Logout.
I'm trying to write a small application that will populate a column in a datagrid with the status of individuals on the network (whether they are in or out of the office). To do this, I need an Event Sync to push out to all network machines that fires when their computer is locked.
Any help would be greatly appreciated. I have also posted in this in a couple other message boards because I'm not 100% certain which board it most pertains to.
Thank you!
|
|
|
|
|
It's possible to do. You'll have to write a small service application that gets installed on each workstation you want to monitor. This montior service will have to create it's own window, then call the Win32 API function WTSRegisterSessionNotification[^] and tell it you want to receive the WM_WTSSESSION_CHANGE[^] message, which BTW, only works with XP and above. In your window code, override WndProc. In there you'll wait for that message to arrive. Look at WPARAM part of the message for that value WTS_SESSION_LOCK and WTS_SESSION_UNLOCK. If you see either of those values, you'll send a message back to your tracking server application.
BTW - Why would you want to do such a thing?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
There is an application the company I work for uses to do many things - one among them being monitoring atttendance. Currently the attendance system is flawed in that it only checks for events fired via Logon and Logoff. However, if somebody simply doesn't log off they can circumvent the whole process.
It isn't at all that we care a great deal about the attendance itself - although we do - it's simply that with the sort of business we do, we need to be in constant contact with one another thus we need to know as soon as possible when somebody is away from their desk. Firing an event on lockdown should resolve this issue.
Thank you for the help.
|
|
|
|
|
<soapbox>I'm glad I don't work there! Really, there is no substitute for laying the Mark I EyeBall on someone for attendance purposes.</soapbox>
There are plenty of times where I get into work and don't log into my machine, or any machine for that matter, until 10, 11am, ... Not to mention being in meetings for hours on end.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am currently getting a "NullReferenceException: object reference not set to an instance of an object" when I try to check a DataRow("columnname") to see if it is a DBNull.Value. The search works fine when you put a value the is in the DB, but when you try to search for an invalid record, it gives me the NullReferenceError. I tried to do a New DataRow, as most NullRefs i've came across stem from missing the New keyword, but it looks like thats not the right way to go. Any suggestions would be appreciated. The line of code that gives the error is "If drCustomersSearch("MortgageNumber") Is DBNull.Value Then"
SqlConnection1.Open()
SqlDataAdapter1.Fill(DsNameandAddress, "NameandAddress")
SqlConnection1.Close()
If txtSearch.Text = "" Then
MessageBox.Show("You must type in a Mortgage Number" & Chr(13) & " to Search For. Try search again.", "Missing Morgage Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
Dim dtCustomersUpdate As New DataTable
Dim drCustomersSearch As DataRow
Dim drCustomersSearchNoRow As DataRow
dtCustomersUpdate = DsNameandAddress.Tables.Item("NameandAddress")
drCustomersSearch = dtCustomersUpdate.Rows.Find(txtSearch.Text)
If drCustomersSearch("MortgageNumber") Is DBNull.Value Then
MessageBox.Show("Your entry is not a valid Mortgage number." & Chr(13) & Chr(13) & "Try search again.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtSearch.Focus()
txtMortgageNumber.Text = ""
Else : txtMortgageNumber.Text = drCustomersSearch("MortgageNumber")
End If
Nathan Lindley, .NET Aficionado
|
|
|
|
|
Perhaps it is not the field "MortgageNumber" that is in error, but the drCustomersSearch that is. You should do a check after this statement:
drCustomersSearch = dtCustomersUpdate.Rows.Find(txtSearch.Text)
To make sure that drCustomersSearch actually found something. Perhaps that was the problem. Hope this helps.
|
|
|
|
|
Thanks for the quick response kschuler
This line of code: If drCustomersSearch("MortgageNumber") Is DBNull.Value Then is where the error occurs. That line is testing to see if the PK (MortgageNumer) of the table (NamesandAddress) is available. The goal is to have it come back null when there is no record, but instead I get the NullReferenceExc. The search works fine when you use a valid MortgageNumber, but for some reason it can't return a row with nulls. Am I missing something to be able to handle a row with nulls? Again thanks for the response.
Nathan Lindleyy, .NET Aficionado
|
|
|
|
|
I didn't think anything else was required to be able to check if something was DBNull.Value. I would try debugging. Put a break point on that statement and see what value is says drCustomersSearch("MortgageNumber") really is...then check what just drCustomersSearch's value is...If that doesn't shed some light on it, you might want to put the whole thing in a try block and in the catch portion put a messagebox to display the exception's message. Sometimes they have better error message there. Sorry I can't be more helpful.
|
|
|
|
|
Thanks again Kschuler.
I did the debugging and the values for the drCustomersSearch comes back as Nothing. I guess when it cant find the row it returns Nothing as the value. I did a check for Nothing, but still got the NullReferenceException. Not sure how to work around this. Might have to rethink the whole approach.
Nathan Lindley, .NET Aficionado
|
|
|
|
|
When you say that you are checking for nothing, are you checking just the DataRow object? I think your code should look something like this:
dtCustomersUpdate = DsNameandAddress.Tables.Item("NameandAddress")
drCustomersSearch = dtCustomersUpdate.Rows.Find(txtSearch.Text)
If drCustomersSearch Is Nothing Then
MessageBox.Show("Customer could not be found.")
Else
If drCustomersSearch("MortgageNumber") Is DBNull.Value Then
MessageBox.Show("Your entry is not a valid Mortgage number." & Chr(13) & Chr(13) & "Try search again.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtSearch.Focus()
txtMortgageNumber.Text = ""
Else : txtMortgageNumber.Text = drCustomersSearch("MortgageNumber")
End If
End If
|
|
|
|