|
Travelthrprog wrote: Now I am not able to reference this dll file to webpage project and build the web page project using devenv.
Why not?? All you have to do is add the .DLL project to your web page project in the same solution, then you won't have this problem at all.
|
|
|
|
|
Hi Dave,
I am able to run it manually. But I want to create msbuild .proj file to do it. I just tried building only proj2 by referencing the proj1.dll file as shown below
<project defaulttargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<propertygroup>
<appname>C:\2proj
<optimize>false
<itemgroup>
<inclibs include="C:\1proj\debug\bin\1proj.dll">
<target name="”Compile”">
<target name="”Compile”">
<msbuild projects="C:\2proj" target="c:\2proj\2proj.sln" "="" references="”@(incLibs)”">
But gives an error
Msb4025-invalid characters in the coding
I also don't know how to build the first proj and then add the reference it in the above code.
Please help.
Thanking you,
Nirmala
|
|
|
|
|
i have a form that is being populated with checkboxes added at runtime. VB6.
If Not rsEMPRTYPESSORTED.EOF Then rsEMPRTYPESSORTED.MoveFirst
Do While Not rsEMPRTYPESSORTED.EOF
cIndx = cIndx + 1
ctrlName = "DynChkBx" & CStr(cIndx)
prevctrlName = "DynChkBx" & CStr(cIndx - 1)
Set chkObject = frmEmployer.Controls.Add("VB.CheckBox", ctrlName, Frame3)
Set prevtxtObject = frmEmployer.Controls(prevctrlName)
With chkObject
.Enabled = False
.Visible = True
.Width = 2800
.Height = 255
.MaskColor = 1
.BackColor = &H8000000F
If cIndx = 1 Then
.Visible = True
.Caption = rsEMPRTYPESSORTED!Name
.Top = 10
.Left = 10
Else
.Visible = True
.Caption = rsEMPRTYPESSORTED!Name
.Top = prevtxtObject.Top + prevtxtObject.Height
.Left = 0
End If
End With
rsEMPRTYPESSORTED.MoveNext
Loop
As you can see i don't know the number of controls or the names.
what i need is to attach events to these controls.
I have tried the withevents but as you know it only works with the last control and cannot be use in an array.
all the controls are intrinsic therefore VBControlExtender is out.
modified on Tuesday, February 19, 2008 1:12 PM
|
|
|
|
|
You have to wire-up the events yourself. Lookup AddHandler and RemoveHandler in the MSDN docs for examples.
|
|
|
|
|
Thank you for your response...however i need to be able to accomplish this in vb6.
|
|
|
|
|
the only way to really do this in vb6 is to have a control array. no matter how many checkboxes you create they all will call the same routine passing the index of that one that's changing. then you can test the index to know whether or not to have happen when changing values...
<br />
Private Sub Check1_Click(Index As Integer)<br />
If Index = 0 The<br />
.<br />
.<br />
.<br />
End If<br />
End Sub
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
There is no equivilent in VB6.
It's been about 7 years since I've used it, so I can't remember how you had to do it. I think you have to create a control array with a known name, then add to that array when you wanted to add controls to it. The event handler had to have the same name as the control array in order to get wired up. ... I think ...
|
|
|
|
|
Thanks again for everyones input.
If i were to use a control array for the checkboxes...can i still use the 'controls.add' to add new members to the array and to frame3 as in 'Set chkObject = frmEmployer.Controls.Add("VB.CheckBox", ctrlName, Frame3)'...? I do not believe that the 'load' statement will accomplish this.
Ultimately, I want to add the checkboxes to frame3 (it has a specified height at design time) and then scroll the checkboxes within it (frame3) if the total height of all checkboxes gets to be > the height of the frame, then catch the individual click events. an array will accomplish the click event problem but i dont know if I can still add them to the scrolling frame without using 'controls.add'.
|
|
|
|
|
lesstraveled wrote: If i were to use a control array for the checkboxes...can i still use the 'controls.add' to add new members to the array and to frame3 as in 'Set chkObject = frmEmployer.Controls.Add("VB.CheckBox", ctrlName, Frame3)'...? I do not believe that the 'load' statement will accomplish this.
The Load statement has nothing to do with creating controls.
Under VB.NET, you can do something like:
Dim newControl As New CheckBox
' setup the properties of the control here...
Me.Controls.Add(newControl)
I think you can do the same thing under VB6, or something very close to it.
<blockquote class="FQ"><div class="FQA">lesstraveled wrote:</div>but i dont know if I can still add them to the scrolling frame without using 'controls.add'. </blockquote>
How about trying it to see what happens??
|
|
|
|
|
you can do something like this to put the controls in the frame.
Dim i As Integer
Set Check1(0).Container = Frame1
Check1(0).Top = 10
Check1(0).Left = 10
For i = 1 To 10
Load Check1(i)
Set Check1(i).Container = Frame1
Check1(i).Left = 10
Check1(i).Top = Check1(i - 1).Top + Check1(i).Height
Check1(i).Visible = True
Next
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
nlarson11...'Set DynChkBx0(0).Container = Frame3'---perfect, that was exactly what i was looking for. Thank You!
|
|
|
|
|
Would anyone be kind enough to assist me with an issue i am having binding the user input through Radio buttons to a field (ExemptStatus) in my access database?
Dim grbExemptStatus As String
'declare radio buttons for Exempt values
If radNonExempt.Checked = True Then
grbExemptStatus = "Non Exempt"
End If
If radExempt.Checked = True Then
grbExemptStatus = "Exempt"
End If
On my User Form, I have a "Exempt" & "NonExempt" within a groupbox called "Exempt Status". I would like the user selection to be passed to a my access database; tblEmployee; fieldname = ExemptStatus. I have tried user Select case as well as If checked = true, but none of that is producing the desired result. Instead the value passed to my table is "exempt status?. Please help! TIA
modified on Tuesday, February 19, 2008 12:27 PM
|
|
|
|
|
You're not making the problem very clear to me, but i think you need code like:
Dim ValueToPass as String
if ExemptRadiobutton.Checked = True then ValueToPass = "Exempt"
if NonExemptRadiobutton.Checked = True then ValueToPass = "NonExempt"
Then send ValueToPass to your dataset.
Does this help?
|
|
|
|
|
Sorry, I didnt make the issue clearer. The code i used is exactly as you suggested, but I am not getting the desired result. Instead of getting the values "Non Exempt" or "Exempt", I get "Exempt Status" which is the text value of the groupbox.
'declare radio buttons for Exempt values
If radNonExempt.Checked = True Then
grbExemptStatus = "Non Exempt"
End If
If radExempt.Checked = True Then
grbExemptStatus = "Exempt"
End If
strEmployee = "INSERT INTO tblEmployees(" & _
"EmployeeNumber, FirstName, LastName, " & _
"HireDate, ExemptStatus, " & _
"Title, BaseSalary) VALUES('" & _
txtEmployeeNumber.Text & "', '" & txtFirstName.Text & _
"', '" & txtLastName.Text & "', '" & _
dtpHireDate.Value.ToString("MM/dd/yyyy") & "', '" & _
grbExemptStatus & "', '" & _
txtTitle.Text & "', '" & txtBaseSalary.Text & "')"
|
|
|
|
|
You have somewhere:
Dim grbExemptStatus as string = ""
and yet...
Console.writeline (grbExemptStatus) produces "exemptstatus"?
If so, I'm not sure what's going on.
|
|
|
|
|
Great!
Your last response provided the clue. Its now working.
Instead of:
Dim grbExemptStatus as string = ""
I had
Dim grbExemptStatus as string
By omitting the = "", it would simply pass the text name to the database instaed of the underlying value.
Thanks a bunch!
|
|
|
|
|
I created a Windows app in vb that searches a database and returns counts that are displayed in a word document. Well, I can run the application just fine under my profile on my pc, but if I run it from another profile on my own box (a standard user) or if I run it under the admin account on my test box, I get the Object reference not set to an instance of an object error.
Now I can’t see just where to error lies because, like I said it runs fine for me. Any ideas?
|
|
|
|
|
Something you haven't counted on is happening, obviously. You need to put some kind of error trapping into your .exe which will help you see where the error is on the other accounts and machines. There were some posts on this late last week on this site.
|
|
|
|
|
Okay, I did that and the clearer error is poining to what I guess is a call to one of my functions called count.
Here is the error that is coming up now:
System.NullReferenceException: Object reference not set to an instance of an object.
at Form1.count (String search, string startDate, string endDate)
at Form1.Button1_Click(Object sender, EventArgs e)
|
|
|
|
|
OK, well my guess is that one or more of your variables (search, startdate, or enddate) aren't instantiated.
|
|
|
|
|
Where would I do that at? In my function call or at Public Function count (byval search as string, byval startDate as string, byval endDate as string) as interger ?
|
|
|
|
|
Honestly, it's hard for me to tell, but the error seems to me to be occuring because the arguments you are passing to your function are not appropriately defined.
|
|
|
|
|
But why would it work under my profile?
|
|
|
|
|
Without seeing the code in your count method in Form1, it's impossible to tell you where the problem is. What we can tell you is that you tried to set a property or call a method on an object that is Nothing , or null in C#.
You probably retrieved an object, or a collection of objects, from somewhere and tried to use it without checking to see if an object was actually returned.
|
|
|
|
|
Well, here is my code for the count function:
Public Function count(ByVal search As String, ByVal startDate As String, ByVal endDate As String) As Integer<br />
Dim number As Integer<br />
Dim pubs As New SqlConnection(ConfigurationManager.ConnectionStrings("WIA_Report_Builder.My.MySettings.wiaConnectionString").ConnectionString)<br />
'pubs = ConfigurationManager.ConnectionStrings("wiaconnectionstring")<br />
'pubs.ConnectionString = ConfigurationManager.ConnectionStrings("WIA_Report_Builder.My.MySettings.wiaConnectionString").ConnectionString<br />
Dim connection As DbConnection = New SqlConnection()<br />
connection.ConnectionString = pubs.ConnectionString<br />
Dim cmd As DbCommand = connection.CreateCommand()<br />
cmd.CommandType = CommandType.Text<br />
Select Case search<br />
Case "TotalAdultPart"<br />
cmd.CommandText = "Select Count (*) from Demographics where AgeatEnroll >= 22"<br />
Try<br />
connection.Open()<br />
number = cmd.ExecuteScalar<br />
<br />
Catch ex As Exception<br />
Finally<br />
connection.Close()<br />
End Try<br />
....<br />
<br />
End Select<br />
Return number<br />
<br />
end function<br />
|
|
|
|