|
This could be a start point (hope it works
Desktop is a ListBox and you can simply find the handle to that listbox by API.
Then using SendMessage API and the ListBoxMessages[^] to work with that.
|
|
|
|
|
I have two tables Table 1, Table 2
Table1's Primary key(Int) is Foreign Key of Table2I'm performing search on Table1 and then picking up single value from Table2. I want to print value all the value from Table1 and single value from Table2. How can i print it on a report. when i try to print value of Table2 it return an empty dataset
|
|
|
|
|
Try changing the join type in CR database links so that all records from Table1 are selected and only matching records from Table2 (Left Outer Join).
Then in the format of the group the record is printed set the suppress formula (VB Syntax):
Formula = (PreviousValue({Table1.PrimaryKeyField}) = {Table1.PrimaryKeyField})
Hope this helps
Tom
|
|
|
|
|
How can I list network domains and/or users in Win NT, 2000 and XP in VB6?
Anyone know an API or other way I will appreciate.
1fm1fu
|
|
|
|
|
I found these examples a while ago (can't remember where sorry). They are for VB script but you will get the idea.
LISTING 1: The GetAvailableNTDomains Procedure
'----------------------------------------------------------------
' Function: GetAvailableNTDomains
' Description: Returns a listing of available NT Domains
' Parameters: None
' Returns: Variant array of NT Domain names.
'----------------------------------------------------------------
Public Function GetAvailableNTDomains()
Dim objIADsContainer ' ActiveDs.IADsContainer
Dim objIADsDomain ' ActiveDs.IADsDomain
Dim vReturn ' Variant
ReDim vReturn(0)
Set objIADsContainer = GetObject("WinNT:")
For Each objIADsDomain In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsDomain.Name
Next
Set objIADsDomain = Nothing
Set objIADsContainer = Nothing
GetAvailableNTDomains = vReturn
End Function
LISTING 2: The GetDomainComputers Procedure
'----------------------------------------------------------------
' Function: GetDomainComputers
' Description: Returns a listing of NT Computer Accounts for a
' given domain
' Parameters: ByVal strDomain - Name of an NT Domain to retrieve
' the list of Computer from.
' Returns: Variant array of NT Computer names for the
' specified domain.
'----------------------------------------------------------------
Public Function GetDomainComputers(ByVal strDomain)
Dim objIADsContainer ' ActiveDs.IADsDomain -
' Container object
Dim objIADsComputer ' ActiveDs.IADsComputer
Dim vReturn ' Variant
' connect to the computer.
Set objIADsContainer = GetObject("WinNT://" & strDomain)
' set the filter to retrieve only objects of class Computer
objIADsContainer.Filter = Array("Computer")
ReDim vReturn(0)
For Each objIADsComputer In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsComputer.Name
Next
GetDomainComputers = vReturn
Set objIADsComputer = Nothing
Set objIADsContainer = Nothing
End Function
The GetComputerUsers Procedure
'----------------------------------------------------------------
' Function: GetComputerUsers
' Description: This function will return the names of the users
' for a specified computer or domain
' Parameters: ByVal strComputerName - Name of an NT Computer or
' domain to retrieve the list of Users from.
' Returns: Variant array of user account for the specified
' computer
'----------------------------------------------------------------
Function GetComputerUsers(ByVal strComputerName)
Dim objIADsContainer 'As ActiveDs.IADsContainer
Dim objIADsUser 'As ActiveDs.IADsUser
Dim vReturn 'As Variant
ReDim vReturn(0)
' Connect to the computer or domain
Set objIADsContainer = GetObject("WinNT://" & strComputerName)
' apply a filter to retrieve only objects of class User
objIADsContainer.Filter = Array("User")
' iterate all user objects within the container
For Each objIADsUser In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsUser.Name
Next
Set objIADsUser = Nothing
Set objIADsContainer = Nothing
GetComputerUsers = vReturn
End Function
Jon
|
|
|
|
|
Hi Everyone,
does anyone know a code to get an index of a currently selected record in a dataset ?
I have a dataset from tblTest in access file(test.mdb), fields are fldID, fldPass.
my adapter is called "adaTest"
my connection is called "conTest"
my dataset is called "datTest1"
Thank You
|
|
|
|
|
Define a Class level variable "
Dim CM as CurrencyManager
'Bind the CurrencyManager on form load.
>Load event (DsCustData1 = dataset, tblCustomer is the table the data set was populated by)
CM = Me.BindingContext(DsCustData1, "tblCustomer")
'End load event
Private Sub btnNextCust_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNextCust.Click
Try
'Next button
'Advance to the next row in the table
If CM.Position < (CM.Count - 1) Then
CM.Position += 1
Else
MessageBox.Show("No More Records.")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
Catch CM As Exception
MessageBox.Show(CM.Message)
End Try
End Sub
Private Sub btnPreviosCust_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreviosCust.Click
Try
'Previous button
If CM.Position > 0 Then
CM.Position -= 1
Else
MessageBox.Show("You Are At The First Record.")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
Catch CM As Exception
MessageBox.Show(CM.Message)
End Try
End Sub
The above would be two buttons to browse forward and back in your dataset.
The dataset has a count property that counts all rows obviously. With the currency manager has a "position" which is dictated by the count property of the dataset.
You should be able to grab what you need from that.
|
|
|
|
|
Is anybody know some company who sale
software made in Vb.Net and work over
internet ?
|
|
|
|
|
Sorry but i don't understand the question. What do you require / mean?
Thanks
"If i was king cigarettes would be free."
|
|
|
|
|
When i bild my software how is best way to sell?
Anyway how to earnings some money with
knowledge Vb.net over internet...
|
|
|
|
|
|
Hi, can any one tell me any free tool to do a report in vb.net? I use the crystal report tool in vb.net and it require me to register on the web. Then I try SQL server 2000 reporting services, but it require sql server sp3a. I alread install sp3a but i don't know it still require it. So now I'm in the middle of the sea, i don't know where to go with the report. If any one know any free reporting tool for vb.net please let me know.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
|
Hi, I made a custom datagrid with a special class that return a dataset.
to make it a short story i need to serialize a datatablestyle whos not marked as serializable. I dont really need the object it self i need the property of the datagridtablestyle and the property of every columnstyle (custom textbox column with events)
long story: my datagrid contain:
- a class that create a connection to DB and where I can pass a sql query that will return me a dataset
-i writte my sqlquery in a property of my customdatagrid and i send the dataset to the cumstomdatagrid.datasource. result = my datagrid is filled at design time from there i can edit the tablestyle.
-problem i find no way of "saving" this tablestyle when i run my programs
tryed to serialize it but datatablestyle aint serializable
HELP ME !
fred
|
|
|
|
|
Why not create a serializable structure that contans properties representing the properties of the object you want to serialize. You could then add a couple of methods to copy the properties to and from object instances.
There's an article here that does a similar thing with a TreeView that also cannot be serialized.
http://www.codeproject.com/vb/net/TreeViewDataAccess.asp[^]
Hope this helps
Tom
|
|
|
|
|
thanks Tom thats exactly what I was looking at. the only thing im wondering is if that is going to work at design time
fred
|
|
|
|
|
|
well thanks a lot atleast someone tryed to help me I think i figured out how to. Question on the side. Let's say i finally make it work would it be usefull to post it as an example?
|
|
|
|
|
Yes, if you find a solution to a problem you have posted you should always post it if no one else has. People ususally search the forums for a similar problem to their own before posting.
Cheers
Tom
|
|
|
|
|
thanks a lot john i finally manage to make it work and its real good looking but its a bit too "hardcore" to be posted i think heheh but may I ask why you used Structure in you exemple instead of a class? (struct = C
|
|
|
|
|
This is a code to calculate a class average. I am trying to modify the btnAverage_click event handler so that intGraderCounter is incremented until it is equal to the number of grades entered, and by using the 1stGrades.Items.Count to determine the number of items in the listbox. The number returned by the count property will be 0 if there are no grade entered. I need to use and if… then selection statement to avoid division by zero and to display a message dialog to the user if there are no grades entered when the user clicks the Average button. I also need help on modifying the code in the btnAverage_Click event handler so that the dblAverage is computed by using the intGraderCounter rather than the value 10. I tried all sorts of things that I could do but the program is still not running right. The code is below...
' handles Add Grade Button's Click event
Private Sub btnAdd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
' clear previous grades and calculation result
If lblOutput.Text <> "" Then
lblOutput.Text = ""
lstGrades.Items.Clear()
End If
' display grade in ListBox
lstGrades.Items.Add(Val(txtInput.Text))
txtInput.Clear() ' clear grade from TextBox
txtInput.Focus() ' transfer focus to TextBox
'' prohibit users from entering more than 10 grades
'If lstGrades.Items.Count >= 10 Then
' btnAdd.Enabled = False ' disable Add Grade Button
' btnAverage.Focus() ' transfer focus to Average Button
'End If
End Sub ' btnAdd_Click
' handles Average Button's Click event
Private Sub btnAverage_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAverage.Click
' initialization phase
Dim intTotal As Integer = 0
Dim intGradeCounter As Integer = 0
Dim intGrade As Integer = 0
Dim dblAverage As Double = 0
' sum grades in ListBox
Do
' read grade from ListBox
intGrade = lstGrades.Items.Item(intGradeCounter)
intTotal += intGrade ' add grade to total
intGradeCounter += 1 ' increment counter
Loop Until intGradeCounter >= 10
dblAverage = intTotal / 10 ' calculate average
lblOutput.Text = String.Format("{0:F}", dblAverage)
btnAdd.Enabled = True ' enable Add Grade Button
txtInput.Focus() ' reset focus to Enter grade: TextBox
End Sub ' btnAverage_Click
Private Sub FrmClassAverage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class ' FrmClassAverage
Need Help!!!!!!!
|
|
|
|
|
Another homework question.
I really must get a copy of your course textbook, but there wouldn't be much point as you've posted most of the test questions on this forum!
For example :
"I need to use an if… then selection statement to avoid division by zero "
easy solution to this. Go ahead and use one.
If you get stuck and post what you have tried rather than a copy of your set homework then we could help. Getting other people to do it for you won't help you to get a job coding, and if you are just learning for the sake of learning then you are really wasting everybody's time, including your own, by not putting a little effort into it.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
|
|
|
|
|
Well, the number one cause of something like this is your not releasing resources, or .Dispose ing object, when you should be. Most of the .NET BCL wraps Win32 API's and objects. When you instantiate, say a Form, your actually allocating resources not managed by the CLR. If you don't Dispose of your objects properly when your done with them, you'll actually orphan these resources and eventually run the system out of things like Handles and Memory. When a resource pool get low, there is no telling what effect it's going to have on the rest of the system, and other applications and services.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
thanks for your reply.
but i'm sure all the object references are disposed and i also add in GC collector explicitly.
actually the 1st windows service that i mentioned previously have been deployed to LIVE application server already.
The 2nd windows service was created to simulate those other windows services reside on the same computer that potentially consume high CPU usage.
in my old/1st windows services that running since 2 weeks ago, it works normal/reasonable Until any other windows services in same computer gone mad, let's say my 2nd windows services CPU usage 90%++
i've tried my best, but still can't solve the problem..
any idea/solution?
thanks..
Sayhigh Soon
|
|
|
|
|
sayhigh wrote:
but i'm sure all the object references are disposed
When anyone says this without a thorough code review, I seriously doubt it. I never say this myself even if I have done a code review. There's always something you miss.
sayhigh wrote:
and i also add in GC collector explicitly
Bad idea. Never, EVER, do this. Unless you know EXACTLY why your doing it. Putting in Collect Statement here and there in no way guarantees underlying reasource are getting freed.
If you have a resource problem in one application, there is no telling what that situation will do to another application. This is why you must do stress testing on your service BEFORE it gets deployed in production. If your 1st service only hangs up when there is a stress condition, you have a problem in your service. I would suggest instrumenting your 1st service so you can do some analysis.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|