|
|
couldn't you just add a reference to the dll and then use it from there??
|
|
|
|
|
but there is no dll file in the source, am i missing something? all i see is a .cs which is a text based file.....i am a little ignorant to the subject of dll files, so if i am missing something please let me know, but i dont see a dll file to reference too. i also do not have a c# compiler in my vs.net
|
|
|
|
|
the C# compiler is freely available. It comes with the .NET SDK which was quite probably installed with VS - if not you should be able to find it on the Microsoft web site. Look for a file on your system called csc.exe. If there is only one cs file it is quite easy to compile it into an assembly (DLLs are properly called assemblies in .NET)
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
the compile was successful, later tonight i will tell yall if it works =)
|
|
|
|
|
Hi,
I am trying to use the propertygrid as a user interface. I have currently only two issues left. The first one is how can I store the value of a listbox in a property. I am using the propertybag as described in "bending the propertygrid". As far as I can see I can only store the text of the listbox. I need both a the one is the key in my database and the other the sensible text.
Secondly I have a couple of multiline textboxes, for instance for some additional information about a person. As the propertygrid is only single line I was thinking of using the description box to display the full text. For this I would need to be able to change the description and set this equal to the information that was just entered at run time. Is this possible or are there some other solutions to tackle this problem?
Any help would be appreciated
Cheers
David J
|
|
|
|
|
Dim PKCalls As DataTable = DirectCast(Session("GetPKCallS"), DataTable)
PKCalls = New DataTable()
Dim sc As New PK.BusinessLogicLayer.Consumer()
Dim tDay As Integer
Dim tCall As Integer
Dim DD As String
Dim CallActivity As String
tDay = Integer.Parse(txtPast.Text)
tCall = Integer.Parse(txtCall.Text)
DD = Today.AddDays(-tDay)
CallActivity = Today.AddDays(-tCall)
PKCalls = sc.GetPKCallSheet(txtGender.Text, txtRace.Text, lblUpDOB.Text, lblLowDOB.Text, ddlSite.SelectedItem.Value, DD, CallActivity)
Session("GetPKCallS") = PKCalls
Dim cr As New ReportDocument()
Dim cx As New ExportOptions()
cr.Load("path to Crystal Report file")
cr.SetDataSource(Session("GetPKCallS"))
Dim N As String
N = "CallSheets" & Session("userOffice") & Now & ".rpt.PDF"
N = Replace(N, Chr(32), "")
N = Replace(N, ":", "")
N = Replace(N, "/", "")
cr.SaveAs("filepath to destination" & N, ReportFileFormat.VSNetFileFormat)
***********************************
*Given the above code, I am able to send this file to where I want it. When
I try to open the file I get this:
"Adobe Reader could not open 'Name.rpt.PDF' because it is either not a supported file type or because the file has been corrupted"
*************************************
Please help, any examples are much appreciated.
Thank you.
|
|
|
|
|
What CrystalReports is writing to your file is not a valid .PDF format. The version of CrystalReports that comes with Visual Studio, apparently, doesn't support .PDF. It looks like you'll have to upgrade to the full version of CR from BusinessObjects.com.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can anybody tell me how I can append to a string using a ‘For Each’ loop?
Here is my loop:
For Each File In Dir.GetFiles("*.lnk")<br />
...<br />
TheString = "Some Data" & Variable<br />
Next<br />
<br />
FinalString =
In the example each loop changes ‘Variable’ and I want to, on the first loop, set ‘FinalString’ equal to ‘TheString’ and then on each loop thereafter I want to append ‘TheString’ to ‘FinalString’
Thanks
Brad
|
|
|
|
|
Use a StringBuilder . You'll find it in the System.Text namespace.
Example using StringBuilder.Append[^]
1. Create the StringBuilder
2. Start the Loop
3. Append to the StringBuilder
4. Repeat 3 as necessary
5. Call ToString() on the StringBuilder to get at the string .
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Thats perfect.
Thank you.
|
|
|
|
|
Hi, I use the following code when the form is load:
Dim cnnCat As New ADODB.Connection
Dim rstCat As New ADODB.Recordset
Dim strCatSql As String ' Hold an SQL statement.
Private Sub frmCategory_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
' Combine the connection string and connect to database.
strConnection = strProvider & strDbPath
'MsgBox(strConnection)
cnnCat.Open(strConnection)
cnnCat.CursorLocation = ADODB.CursorLocationEnum.adUseClient
' Get the record from the table.
strCatSql = "SELECT * FROM tblCat"
rstCat.Open(strCatSql, cnnCat, _
ADODB.CursorTypeEnum.adOpenKeyset, _
ADODB.LockTypeEnum.adLockOptimistic)
With rstCat
If .RecordCount > 0 Then
' Populate the recordset.
.MoveFirst()
.MoveLast()
' Display the record on the form.
Call ReadRecord()
End If
End With
End Sub
And the following code to close the form:
Private Sub btnClose_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnClose.Click
' Prompt the user before close the form.
dlrUserAnswers = MessageBox.Show("Are you sure you want to close " & _
"Category form?", "Close Category", MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If dlrUserAnswers = DialogResult.Yes Then
' Close database connection.
rstCat.Close()
cnnCat.Close()
' Release the objects to free memory.
rstCat = Nothing
cnnCat = Nothing
' Close the form.
Me.Close()
End If
End Sub
But when I start the form again, it display an error message as below:
An unhandled exception of type 'System.NullReferenceException' occurred in NGOCRC-Document Management.exe
Additional information: Object reference not set to an instance of an object.
Does anyone know why this problem occure? and how to solve this problem?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
On what line does the exception occur?
It looks like your HIDING the form, not destroying it and creating a new one. This would cause your two ADODB objects at the top of your code to be created once, and when destroyed by your Form close code, never created again. It's bad practice to use "global" objects like this. What your doing in your code is, apparently, when the form is opened creating and HOLDING ON TO database connections and resources and not releaseing them until the form closes. You should NOT do this. Database resources are expensive and should be opened, used, and then released as soon as possible, preferrably inside the same method.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
On what line does the exception occur?
This exception occure at the line that is bold:
Private Sub frmCategory_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
' Combine the connection string and connect to database.
strConnection = strProvider & strDbPath
'MsgBox(strConnection)
cnnCat.Open(strConnection)
cnnCat.CursorLocation = ADODB.CursorLocationEnum.adUseClient
' Get the record from the table.
strCatSql = "SELECT * FROM tblCat"
rstCat.Open(strCatSql, cnnCat, _
ADODB.CursorTypeEnum.adOpenKeyset, _
ADODB.LockTypeEnum.adLockOptimistic)
' ... The below code are the same as the one that post before.
End Sub
Dave Kreskowiak wrote:
It looks like your HIDING the form, not destroying it and creating a new one
Because I was experience with VB6 I used to close the form by Unload Me . When I move to VB.NET I found Show , ShowDialog and Close method but I could not find Unload Me anymore. I think Close might override Unload Me statement. But after I change the close procedure as the code below (the bold code is the code that I block comment or delete from the procedure), the it is working whether I start and close and restart the form many time.
Private Sub btnClose_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnClose.Click
' Prompt the user before close the form.
dlrUserAnswers = MessageBox.Show("Are you sure you want to close " & _
"Category form?", "Close Category", MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If dlrUserAnswers = DialogResult.Yes Then
' Close database connection.
rstCat.Close()
cnnCat.Close()
' Release the objects to free memory.
'rstCat = Nothing
'cnnCat = Nothing
'' Close the form.
'Me.Close()
End If
End Sub
But one new problem come out when I try to add the record that is duplicate in the database. Whether I use Try Catch End Try to block an exception but I could not work around with the other function such as MoveNext , MovePrevious ... Do you have any idea about that?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Dave Kreskowiak wrote:
It's bad practice to use "global" objects like this. What your doing in your code is, apparently, when the form is opened creating and HOLDING ON TO database connections and resources and not releaseing them until the form closes. You should NOT do this. Database resources are expensive and should be opened, used, and then released as soon as possible, preferrably inside the same method.
Dave, I wonder about the code that I get it the first time before I customize it:
dim cnn as New ADODB.Connection
dim rst as New ADODB.Recordset
Privat Sub Form1_Load()
cnn.Open("Provider...;Data Source=...")
' Get the record from the table.
rst.Open("SELECT * FROM [TableName]", cnnCat)
' ...
' The code to check the record and put it on the form.
rst.Close
cnn.Close
rst=Nothing
cnn=Nothing
End Sub
The code that I wonder is the bold line:
rst.Close
cnn.Close
rst=Nothing
cnn=Nothing
I wonder: if i release the recordset and the connection, how about the code that I write for an Add new record button, Update, Delete, Move (previous, next, last, first)? Do I need to open it again? If Yes, then I have to open it again how about the record position? Does it remember the last position in the recordset? I really wonder about that, so that is the reason that I write a GLOBAL object. Could you give me some comment and correct it with a small sample code?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
In a normal operation, you would setup your connection and command objects, then open the connection, execute your SQL command, then close the connection.
Now, for updates, deletes, (moves? are unnecessary), record position is not important. You would supply your SQL with the primary key of the record you want to work with. That key is the unique identifier column of your table that attaches a unique ID to each and every record in your table.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
In a normal operation, you would setup your connection and command objects, then open the connection, execute your SQL command, then close the connection.
It is a little bit abstract for me with the command object. Could you provide me with a small sample code?
Dave Kreskowiak wrote:
Now, for updates, deletes, (moves? are unnecessary), record position is not important. You would supply your SQL with the primary key of the record you want to work with. That key is the unique identifier column of your table that attaches a unique ID to each and every record in your table.
I think i have a little bit problem with this step. I really don't understand what is the unique ID of each record. Now I prepare to read any sample code from the web about sample ADO project in VB6. But I think that VB6 document is less then before after VB.NET is come out.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
The man from SCN-CO wrote:
I think i have a little bit problem with this step. I really don't understand what is the unique ID of each record.
A little light in the database department are you? I would suggest picking up a book on Access and diving into databases before you try and write code to manipulate something you don't understand. Primary Keys are a basic part of any relational database and are used to uniquely identify records in a table. This key, which can be a number that is incremented from one record to the next or a generated value or GUID, is a part of each record in the table and is guaranteed unique to that record in that table. When you have two or more identical records in a table, the Primary Key is the only way tell them apart. It is also used to identify that record when used in relation to a record in another table.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
I would suggest picking up a book on Access and diving into databases before you try and write code to manipulate something you don't understand.
Sure I really have some problem with access. I know myself that I have to update from the beginning whether some point I already know but I have to verify myself with the knowledge that I have. I used to read the book about access, vb6 .net and sql server. But I just read for the point that I need to work with.
Dave Kreskowiak wrote:
This key, which can be a number that is incremented from one record to the next or a generated value or GUID, is a part of each record in the table and is guaranteed unique to that record in that table. When you have two or more identical records in a table, the Primary Key is the only way tell them apart.
The primary key in my database is a text data type. I allow my user to input both numeric and alphabit character. I think if I choose to move the record base on increment primary key it might not be possible. But now it has no problem any more because I just open the connection and recordset then after I finish using it I just close the connection and recordset. I did not set the connection and recordset to nothing.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
OK, I am now in a hurry and I don't have time to read your code.
But I guess that your problem is due to the Garbage Collection.
You know, in .NET framework, when you set an object to nothing, it's memory won't be free at the same time.
but it will be send to GC and GC will in some other time remove it.
I guess your promblem maybe due to this.
|
|
|
|
|
Ok, Now I don't have any problem any more because I don't set the connection to nothing anymore. I just close the connection and recordset but do not set the connection and recordset to nothing. There is no error anymore Thank for your comment!!!
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi am using vb6 and i need help on the following
1)Hi i want to make reports where a user can select the range of data he wants to see from a form ie starting date to ending date, columns per page, starting client name to ending client name.
2)i want to use a picturebox control or image control to display a photo from an access db the field name is photo and the datatype is OLE object. Also help me to use a commondialog control to add and edit the photo at run time.
3) i want a user to be able to search for a record from a datagrid or mshflexgrid using a textbox control i.e. if he wants to search for a client name called charles when he enters the first character c the first record when arranged in ascending is highlighted and if he enters a character like k and there is no client starting with k it displays the nearest record to it.
Thank you.
|
|
|
|
|
stevemwangi wrote:
2)i want to use a picturebox control or image control to display a photo from an access db the field name is photo and the datatype is OLE object. Also help me to use a commondialog control to add and edit the photo at run time.
I used to display the picture from access to VB6, but the photo field is no an OLE object. It is a Memo (contain the string character). The field is store the path point to the picture/image then I will use my VB application load the picture from that path. VB will display difference picture base on difference path of each record. I think if you use OLE object in your database file when the record is increase your database might growth rapidly and your database might stop running when it reach it limite of capacity.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi,
In my VB application i'm trying to embed IE.
So in my code i use:
Dim MyIE As New InternetExplorer
and try to use it properties.
But during runtime i get error as:
"Class Does Not Support Automation or does not support expected interface".
After this i tried installing windowscript 5.6 and
vbrun60sp5.exe..But still same problem.
I'm using VB6.0 SP5. and IE version: 6.0.2800
Pls help.
Thanks
Ram
|
|
|
|
|
I'm not to sure, if it's available , or will work for vb 6, haven't used it for quite sometime, but if you can just add a com control. Look for one Called AxWebBrowser. As that's just a com for IE. Works for what I want it to do in my vb.net coding.
|
|
|
|
|