|
Eddy Vluggen wrote: "A2" is already a string?
it is a short string.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I had hoped never to be reminded of the shortstring again, along with the existence of the AnsiString, the PChar, the..
I are troll
|
|
|
|
|
Perhaps:
.SubItems.Add(MyDataReader("A2").ToString)
?
|
|
|
|
|
Thank you it works
|
|
|
|
|
Hi,
In my application I am trying to export a Crystal Report to a PDF and then use that PDF. But the problem I have is that the export doesn't complete quick enough for my application to use it. Any ideas on the best way to pause my application unitl the export is complete?
Thanks
|
|
|
|
|
Liqz wrote: Any ideas on the best way to pause my application unitl the export is complete?
I take it you are trying to open the PDF but failing because it is still being written to?
What you could do is loop around attempting to open the file. When you manage to open the file you know it is ready. Until then you just loop around again.
Also, be aware that this could potentially introduce an infinite loop in your application if the file handle is never released by Crystal Reports so you will want to build in a time out mechanism so that after attempting for a period of time you give up.
|
|
|
|
|
You can 'halt' the current thread, stopping execution of your code (5 seconds in the example below)
System.Threading.Thread.CurrentThread.Sleep(5000) This will prevent the form from drawing, because your application isn't processing messages. An alternative method would be to put the current time in a variable and enter a loop with a call to Application.DoEvents . Break the loop if a specified amount of time hath expired.
Third possibility is the use of the timer-component
Happy Programming!
I are troll
|
|
|
|
|
Eddy Vluggen wrote: a call to Application.DoEvents
That way madness lies.
|
|
|
|
|
Don't be afraid, and embrace that madness - you don't want to be the last sane person here, do you?
Insanity doth tickle the imagination
I are troll
|
|
|
|
|
Bad solution. Your code assumes that the operation will, forever, take under 5 seconds to complete. A better solution would be to try and open the file with DenyShareAll sharing permissions every so often, say 500 milliseconds, until the file opens. Then you'll know the file is finished writing, no matter how long it takes.
|
|
|
|
|
Normally, I'd reply that any working solution isn't bad, but this is a dirty hack and not a solution. The thing is that you notice that 5 seconds isn't always enough, so you extend the period to 10 seconds. That's kinda cool when the task usually finishes within half a second, leaving you to wait for 9,5 seconds every dang time. How often do you come across a place where the application is waiting, no disk-activity and no cpu-activity?
My train of thought departed from the application. What do you do when you can't change the code to send a message to signal an event? It didn't even cross my mind that one could check the object that the application is working on, I just kept thinking on the same track - where the problem arises.
In short, thanks for showing a better option than the quick-and-dirty 'solution'
I are troll
|
|
|
|
|
Thank you both for your suggestions, they have come in very handy
|
|
|
|
|
Hello
Language VB.net Visual Studio 2005
This sounds like it's should be simple, but I've been working on it all night with no joy. Basically, I need to create a DataGridView on the fly and it will contain a column of various website addresses. However, if I use a HyperLinkColumn then I cant get the cells to contain the URLs. Either all the cells contain the same URL, or each cell contains the correct value - but there's no hyperlink. First top solve it get's a beer (as long as they're in Camden)
I've posted my project here: http://www.camdenconsultancyservice.co.uk/Test/Grrrrr.zip
I've pasted the code below ..... now I need to get some sleeeeeeeeeep.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'---adding columns---
DataGridView1.Columns.Add("ID", "Product ID")
DataGridView1.Columns.Add("Name", "Product Name")
DataGridView1.Columns.Add("Description", "Description")
DataGridView1.Columns.Add("Price", "Price")
'DataGridView1.Columns.Add("Website", "Website")
Dim HyperLinkColumn As New DataGridViewLinkColumn
Dim DataGridViewRow As New DataGridViewRow
With HyperLinkColumn
.Name = "WebsiteColumn"
.HeaderText = "Website"
'.DataPropertyName = "Website" 'this carries the values across
.UseColumnTextForLinkValue = True
'.ReadOnly = False
'.Visible = True
'.Text = "http://www.google.com"
End With
DataGridView1.Columns.Add(HyperLinkColumn)
For i As Integer = 0 To 4
'---create a row---
Dim item As New DataGridViewRow
item.CreateCells(DataGridView1)
With item
.Cells(0).Value = i
.Cells(1).Value = "Product " & i
.Cells(2).Value = "Description of Product " & i
.Cells(3).Value = "99.99"
'.Cells(4).Value = "http://www.evergreenhouse.co.uk" & i
'HyperLinkColumn.Index(i).Text = "http://www.google.co.uk" & i
'HyperLinkColumn.Index(i).Value = "http://www.google.co.uk" & i
HyperLinkColumn.Index
'MsgBox(.Cells(4).Value)
End With
'HyperLinkColumn.Text = "http://www.evergreenhouse.co.uk" & i
'---add the row---
DataGridView1.Rows.Add(item)
Next
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If DataGridView1.Columns(e.ColumnIndex).GetType Is GetType(DataGridViewLinkColumn) Then
'Open document by Process.Start().
System.Diagnostics.Process.Start(DataGridView1(e.ColumnIndex, e.RowIndex).Value.ToString)
End If
End Sub
End Class
|
|
|
|
|
OK, this is some really ugly code. I'd recommend using a collection of some kind to hold your data rather than trying to put the data directly into the DGV yourself.
First, you're LinkColumn definition is completely screwed up. It should look something like:
Dim newWebColumn = New DataGridViewLinkColumn
With newWebColumn
' This is the column name in the datatable or
' the property name in the collection that this
' column will get it's data from.
.DataPropertyName = "ProductURL"
.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
.HeaderText = "Web Address"
.ActiveLinkColor = Color.White
.LinkBehavior = LinkBehavior.SystemDefault
.LinkColor = Color.Blue
.Trackvisitedstate = True
.VisitedLinkColor = Color.YellowGreen
.Resizable = DataGridViewTriState.True
.ValueType = GetType(String)
End With
columns.Add(newWebColumn)
|
|
|
|
|
How can I create a data report.
The data report that I will will going to be printed if the user want to print
report.I am also creating a guest reservation system but I still have lack of ideas
for system.If someone would give some idea what will I do first.
|
|
|
|
|
dfan23 wrote: If someone would give some idea what will I do first
Research;
- Crystal Reports
- Microsoft Report Viewer
- Microsoft Access
dfan23 wrote: .I am also creating a guest reservation system but I still have lack of ideas
for system.
Start with a description of the things that it should be able to do, and the stuff that it's going to persist to disk
I are troll
|
|
|
|
|
Search for Crystal Reports for .NET tutorial[^]
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Just wanna ask sir
1.Can I do a data report for my database like in
the older version of vb(vb 6.0)
2.How can I print for example in the database name
guestReservation with table guestinfo that it will
only print the records of guestinfo
*thanks a lot *
|
|
|
|
|
Crystal accepts data in many forms. Personally in like to collate the data into a typed dataset and then pass the dataset to crystal.
Writing reports with Crystal is a big topic all of its own, and there are many good books on the subject.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Would you mine sir if may I get your email?
Just wanna send you the forms that I have created
so that you can give me better advice.
Sorry for that question sir,
by the way sir I'm a first year college student in philippines that
we have to create a simple hotel reservation system with
database.
|
|
|
|
|
You should try to Create Report by using PrintDocument Control.
Because CRYSTAL REPORT and Report Viewer are not sutable for VB 6.
Secondly you can use Microsoft Access Report Viewer for Generating Report.
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
hi... im trying to convert a code according to my list.. my list in a table are:
<folder> <portal>
C0014 SEJATI
BRT04 BRT01
MBS01 MBSB
MBS02 MBSB
C0015 SEJATI
when i call
convertCoop(coop, portal)
error "Value cannot be null.Parameter name: dataSet"
what does it mean?
Private Sub convertCoop(ByVal coop As String, ByVal portal As String)
Dim conn1 As New SqlClient.SqlConnection("Data Source=10.0.0.70;User ID= sysadm;Password=sysadm;Initial Catalog=SPGA_Latihan;Persist Security Info=True;")
Dim comm As SqlClient.SqlDataAdapter = Nothing
Dim ds As DataSet = Nothing
Try
Dim strSQL2 As String = "SELECT folder, portal FROM kodPortal WHERE folder ='" & coop & "'"
conn1.Open()
comm = New SqlClient.SqlDataAdapter(strSQL2, conn1)
comm.Fill(ds, "kodPortal")
portal = ds.Tables(0).Rows(0).Item("portal")
conn1.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
If Not conn1 Is Nothing And conn1.State = ConnectionState.Open Then
conn1.Close()
End If
conn1 = Nothing
comm = Nothing
End Try
End Sub
|
|
|
|
|
It means you have no idea what you're doing. At a guess, it means that the parameter cannot be null. so, try Dim ds as DataSet = new DataSet()
From MSDN "[Visual Basic, C#, C++] The following example uses the SqlCommand, SqlDataAdapter and SqlConnection, to select records from a database, and populate a DataSet with the selected rows. The filled DataSet is then returned. To accomplish this, the method is passed an initialized DataSet, a connection string, and a query string that is a Transact-SQL SELECT statement."
Did you bother to read the docs. The dataset needs to be initialised. You're getting an error telling you the same thing.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thanks a lot.. actually im not use to programming.. and my english r not quite good.. so when i try to google to find doc related to my problem, most of it r not.. maybe bcoz i put the wrong words.. the problem solve but how i can retrieve the value from portal that is inside the function to be call in other private sub.. bcoz im calling the function inside the other private sub called SEMAK. how can i get the latest value of portal inside that sub? or can u give me link to any doc related to my question.. thank you for helping me..
|
|
|
|
|
zaimah wrote: comm.Fill(ds, "kodPortal")
portal = ds.Tables(0).Rows(0).Item("portal")
whether you check the dataset contain any row? First create a instance of dataset.
|
|
|
|