|
Hi,
Thx for the reply.
The given integer is coded like this ( on the database )
Val*math.Pow(2,Bitpos) or Val*math.Pow(2,Bitpos) .. and so on for each Charac.
When on a windows form selection is made ( interface per xml ) I have to add selected values to an integer and later compare it with the integer from the database.
Hope it is explained now. If not then pls do ask.
|
|
|
|
|
nik050706 wrote: The given integer is coded like this ( on the database )
Val*math.Pow(2,Bitpos) or Val*math.Pow(2,Bitpos) .. and so on for each Charac
In that case the bit position is zero based, so the least significant bit is unused. Is there any special reason for that?
What does your code have to do exactly? Do you only need to write code to do the bit operations, or does it have to parse the xml code and use the bit positions from that to do the calculations?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
this xml is just an example. Actual one is large having more than 70 such properties. This method is applied to save memory as the aplication only works with binary files. This way we have all the properties coded in one int32.
an employee can have a value like 5869586 on the database representing his features and properties.
Now on a windows form many properties can be selected to search for employees. Condition is that employees should be seleted which has atleast one of these properties set.
What i did. I added all the selected properties like this which seems to work
for each Feature in EmployeeFeatures
for each Property in Feature
myint32 = myint32 or Property.Val*math.Pow(2,Property.Bitpos)
next
next
and to compare (5869586 and myint32) > 0
somebody told me i need to shift bits and calculate each val separately
something like myint32 = myint32 or Property.Val >> Property.Bitpos
which is unclear to me and find it tedious
|
|
|
|
|
Hello,
I'm trying to send a few BiDi commands to a printer that I have. I've been researching for a while and found out that in order to do this, I need to use the IBiDiSpl interface, which is documented here:
http://msdn.microsoft.com/en-us/library/ms535480(VS.85).aspx
My problem however, is that I don't know how to use interfaces, especially those that are part of the Windows API, not coded in VB etc...
I have no code regarding this issue (I don't even know where to start) but am somewhat familiar with regular Windows API calls.
Does anyone know how to use this interface in VB.NET 2008?
Thanks,
|
|
|
|
|
Dim s1 As String = "v50"
Dim s2 As String = "v1"
Dim s3 As String = "v7"
If s1 >= s2 And s1 <= s3 Then
MessageBox.Show("True")
Else
MessageBox.Show("false")
End If
from above, i should get false because v50 is bigger than v1 and v7 but it is giving true.
how should i solve this problem.
|
|
|
|
|
It is giving you the correct answer - when you compare strings, "v5x" will always be between "v1x" and "v7x", whatever x is - blank, nonexistent, any character.
If you want it to say that 50 is greater than 7, then you could put the numerical part of your string into an integer field and compare those.
|
|
|
|
|
1 - read a book on programming
2 - once you understand the concepts of a string type, use int.TryParse to do what you want
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Member 1837661 wrote: from above, i should get false because v50 is bigger than v1 and v7
No, you shouldn't, as it isn't.
If you want to compare the strings as something other than strings, you can make a custom comparer. For example:
Public Class WeekComparer
Inherits IComparer(Of String)
Public Sub Compare(x As String, y As String) As Integer
If x.Chars(0) = "v" and y.Chars(0) = "v" Then
Return Int32.Parse(x.Substring(1)) - Int32.Parse(y.Substring(1))
Else
Return String.Compare(x, y)
End If
End Sub
End Class
Usage:
Dim c As New WeekComparer()
If c.Compare(s1, s2) >= 0 And c.Compare(s1, s3) <= 0 Then
MessageBox.Show("True")
Else
MessageBox.Show("False")
End If
(Disclaimer: code is not tested and may contain minor errors.)
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
... or you can ask a Windows Explorer component to do it its way; in C# you would need
this P/Invoke prototype, something similar would apply to VB.NET:
[DllImport("shlwapi.dll", CharSet=CharSet.Unicode, ExactSpelling=true)]
private static extern int StrCmpLogicalW(string s1, string s2);
|
|
|
|
|
Hi, I have written a small Windows Service app in VB.Net (1.1) to monitor the event logs on my server (Windows Server 2003), and I have modified a couple of my existing apps to write to the Application Event Log.
The events are writing to the log OK (I can see them fine in Event Viewer). And the Monitor can see new events being logged in both the System and Security logs.
But it does not react to any events being created in the Application log, either from my own apps or any others.
Does anyone have any suggestions why this could be? I have coded the three event log instances just the same, yet only 2 out of 3 work as expected. Thanks in advance.
|
|
|
|
|
Well.. I've done something similar in the past and never had issues with it. The Application log is not really different so my best guess (without any code) would be a typo somewhere.
Do you have any errors it returns ? Or maybe an idea where in your code it happens ? Posting this would help a lot..
Meanwhile.. simple, little piece of code to list stuff in the eventlogger:
(console app)
dim elEvent as new system.diagnostics.EventLog("Application")
dim elEventEntry as System.diagnostics.EventLogEntry
for each elEventEntry in elEvent.Entries
console.writeline(elEventEntry.TimeGenerated.Tostring & " - " & elEventEntry.Source.Tostring & " - " & _
elEventEntry.Category.Tostring & " - " & vbcrlf & vbcrlf & elEventEntry.Message.tostring)
next
|
|
|
|
|
Thanks. I've now discovered that it is in fact managing to react to some events in the application log - I left it active overnight and it spotted some virus software log entries.
So the problem is actually not what I thought - it is reacting to some changes in the Application log, just not all of them.
I think I'll have to look more deeply into the difference between my events and the virus software ones to see where they differ.
Helen Bull
|
|
|
|
|
i have two WebBrowser object on my Form with following line of code against a button click event
WebBrowser1.Navigate("http://localhost/WebApplication1/Default.aspx")
WebBrowser2.Navigate("http://localhost/WebApplication1/Default.aspx")
in Default.aspx i am displaying SessionID ...
Default.aspx page is showing same SessionID for both WebBrowser1,and WebBrowser2 objects.
how to get different sessionID in both WebBrowser1,and WebBrowser2 controls?
r00d0034@yahoo.com
|
|
|
|
|
Make sure you are on different sessions.. i think the default behaviour of the WebBrowser control inherits from Internet Explorer stuff ( probably).. and as I recall, while in the same thread or executable, sessions are shared. ( like in internet explorer when you open different tabs in the same browser)
|
|
|
|
|
am using asp role / membership provider i created with aspnet_reg
i can create user and assign them role
but when the want sign in it keep rejecting them. any solution pls
|
|
|
|
|
Perhaps asking in the right forum ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi all
i want to change the leftmost dimension of a two - dimensional array. but redim statement does not change the Left Most dimension. For example i declare a two-dimensional array as following
Dim WrappingItemInfo(0, 4) As String
after that i write following statement at particular condition
ReDim Preserve WrappingItemInfo(1, 4)
but above statement give error "'ReDim' can only change the rightmost dimension.".
so how can i change the leftmost dimension of an array ?
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
set WrappingItemInfo(1) to be a new array of four elements. This would work in C#, should work in VB.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
sir,
thanks for your response but i does not properly get you
can you explain it bit more with code(whether in c# or vb)
one more thing. in my previous post, i simply give a example. In real condition, Leftmost dimension of an array is increased every time by one when a particular condition is found.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
int [,] n = new int[5,5]();
n[0] = new int[5]();
something like that
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You should use a dynamic collection instead of an array, like a List(Of String()).
An array can't be resized, so what the ReDim command does is to create a new array, and copy all data from the old array to the new array. It can get pretty expensive as the array grows...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello
How i can let the user who use my application when he click enter
so the button1_click event is fire
Thank for your help
Assaf
|
|
|
|
|
Well, don't call it button1, for a start ( that's just dumb )
You have properties on the form for the AcceptButton and CancelButton. These set what buttons are pressed by Enter and Escape
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm sorry to ask this question on this form, it's an asp.net application
But Thanks for your help
Assaf
|
|
|
|
|
Ah... well, it's good to consider the forum you use, and how you word the question, so you can feel sure people will actually understand what you're asking.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|