|
Actually the datatype for EntryDate is DateTime in the database. So only a legal Datetime value or Null value can be passed. In the front end interface I'm not using any textbox, instead there's a datetime picker. If somebody selects any date it is passed in the database otherwise NULL is passed.That's why when I retrieve data from that table in crystal report it can't show anything else other than a blank if the entrydate is null in database. Moreover if suppose, the entrydate textbox in crystal report has background color say Gray, but when no data can be retrieved for the field it is turning completely white- a white field among all gray fields, so awkward.
By the way I'll request you to focus on the ZeroValueString property of a
textbox in crystal report. As per what I hav read from other sources, the
ZeroValueString property shows a custom defined Value/String in a textbox if Null value is retrieved from database. I hav played with it but couldn't figure it out. Can u solve it. Awaiting for ur reply. Thanks.
Regards.
|
|
|
|
|
Create a formula field in the report that will contain either the date formatted as a string, or a "Not Available" if the date is a null value.
|
|
|
|
|
Hello,
I have this code:
Private Sub Form_Load()
Dim lab(30, 100) As Label
Dim i As Integer, j As Integer
For i = 1 To 30
For j = 1 To 100
lab(i, j).Caption = "A"
lab(i, j).AutoSize = False
lab(i, j).Height = 13
lab(i, j).Width = 9
lab(i, j).Left = j * 9
lab(i, j).Top = i * 13
Next j
Next i
End Sub
and have this error:
Runtime error '91':
Object variable or With block variable not set.
Help me please!
T.I.A
|
|
|
|
|
You have only declared the label object, not instantiated it...
Try this:
set lab(i, j)= New Label
as the first line of the inner loop
HTH
|
|
|
|
|
ChandraRam wrote: Try this:
set lab(i, j)= New Label
I had this error:
Compile error:
Invalid use of New keyword
|
|
|
|
|
Well, I don't know how you do it exactly in VB6, but the problem in your original code is that you had not instantiated the label object.
Maybe lookup CreateObject, or some such thing instead of the New...?
|
|
|
|
|
Well, once you get past this problem, you're going to be disappointed. Putting 3,000 label controls on a form will make it render and behave slowly. Using thousands of controls on a form is not a good idea. I would suggest comming up with your own code to draw all of this data yourself. Controls are a bit too heavy for this.
|
|
|
|
|
You might want to try this:
Dim newLabel As New Label
newLabel.Location = ...
Set lab(i,j) = newLabel
|
|
|
|
|
Dave Kreskowiak wrote: You might want to try this:
Dim newLabel As New Label
newLabel.Location = ...
Set lab(i,j) = newLabel
1st: I'm using VB6.0.
2nd: I tried:
Set lab(i, j) = New Label
But I have "Invalid use of New keyword" exception.
3rd: I don't need 3000 labels in fact. that was just a joke
Try:
Dim lab(5, 5) As Label
|
|
|
|
|
you need to 'Load' the new control.
Example:
Load grpButtons(iBtn)
With grpButtons(iBtn)
.value = False
.Left = grpButtons(0).Left
.Top = grpButtons(iBtn - 1).Top + .Height
.Caption = frm.sFormName
.Visible = True
End With
'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 wrote: Load grpButtons(iBtn)
I tried this too but still I have this absurd exception!
Runtime error '91'
Object variable or With block variable not set!!!!
|
|
|
|
|
Sorry for not looking closer...
You cannot do what your code says you want to do in vb6.
First of all the creation of controls at runtime -- it's based on an already existing control that has the index property set to 0. You can only create additional instances using the 'load' command. You cannot create any control on the fly unless there is already one present on the screen.
If you look at the click event of the label you'll notice that a new argument is in the signature of the routine.
Private Sub Label1_Click(Index As Integer)
this allows you to create a new intance at run time because every label when clicked on will come into this routine and then you can test what value is the index, etc. because you cannot assign an event handler at runtime like you can in dotnet, you have no choice...
'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
|
|
|
|
|
I haven't used VB6 in a VERY long time. Look at all the things that I've (thankfully) forgotten!
|
|
|
|
|
your lucky... I'm still blessed to work with it occassionally...
'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
|
|
|
|
|
Ah, yes...
I vaguely remember reading something like this...
|
|
|
|
|
At last!
I found the solution!
I added an indexed label in my form, changed its Index to 1 and copy 10 labels from that, like this:
For t% = 2 To 10
Load lblPage(t%)
lblPage(t%).Top = (t% \ 100) * lblPage(1).Height
lblPage(t%).Left = (t% Mod 100 - 1) * lblPage(1).Width
lblPage(t%).Visible = True
Next t%
Thank you all
|
|
|
|
|
Hi all,
i'm trying to save an image in database ina binary format,
Image:Is my table name
Pic is my column name
these are my functions:
<WebMethod()> _
Public Function ImageToByte(ByVal filepath As String) As Byte()
Dim fs As FileStream = New FileStream(filepath, FileMode.Open, FileAccess.Read)
Dim BR As BinaryReader = New BinaryReader(fs)
Dim photo As Byte() = BR.ReadBytes(fs.Length)
BR.Close()
fs.Close()
Return photo
End Function
<WebMethod()> _
Public Sub saveimage(ByVal imagebyte As Byte())
Dim cnn As New SqlConnection("myconnectionstring")
Dim cmd As New SqlCommand()
Dim da As New SqlDataAdapter()
Dim cbuilder As New SqlCommandBuilder(da)
Dim ds As New DataSet()
Dim cmdStr As String
cmdStr = "SELECT * FROM Image"
If cnn.State = ConnectionState.Open Then
cnn.Close()
End If
cnn.Open()
cmd.Connection = cnn
cmd.CommandText = cmdStr
da.SelectCommand = cmd
da.Fill(ds, "Image")
Dim nrow As DataRow
nrow = ds.Tables("Image").NewRow()
nrow.Item("Pic") = imagebyte
ds.Tables("Image").Rows.Add(nrow)
da.InsertCommand = cbuilder.GetInsertCommand
da.Update(ds.Tables("Image"))
cnn.Close()
End Sub
and this is my code for using this functions:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ws As New localhost.Service()
Dim a As Byte()
a = ws.ImageToByte(TextBox1.Text)
ws.saveimage(a)
But when i click on Button1 this Error occured:
SQLException was unhandled by user code
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: String or binary data would be truncated.
why this error occured?
please help me,
Thank You
Hoda
|
|
|
|
|
Saba02 wrote: System.Data.SqlClient.SqlException: String or binary data would be truncated.
Your column don't have enough capacity to hold the binary data. Try incresing the column's allowed space.
|
|
|
|
|
It's been a few days and I have not been able to figure out my mistake. I have 2 combo boxes I want the two combo1 as the parent and combo2 to be the child.
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Dim strProvider As String = "Microsoft.Jet.OLEDB.4.0"
Dim strConnect As String
Dim cnn As OleDbConnection
Dim cmd As OleDbCommand
Dim odr As OleDbDataReader
Dim da1 As OleDbDataAdapter
Dim da2 As OleDbDataAdapter
' Connect to unsecured Access database
strConnect = String.Format("Provider={0};Data Source={1};", strProvider, txtPath.Text)
'Initialize the DataSet object
Dim ds As New DataSet()
'Create Command object
Dim cmd1 As String = "SELECT * FROM ER"
Dim cmd2 As String = "SELECT * FROM Thickness"
Try
' Retrieve and open a connection.
cnn = New OleDbConnection(strConnect)
cnn.Open()
'Initialize the DataAdapter object and set the SelectCommand property
da1 = New OleDbDataAdapter(cmd1, cnn)
da2 = New OleDbDataAdapter(cmd2, cnn)
'Populate the DataSet
da1.Fill(ds, "ER")
da2.Fill(ds, "Thickness")
' Define the relationship between the tables.
ds.Relations.Add(New DataRelation( _
relationName:="relERThickness", _
parentColumn:=ds.Tables("ER").Columns("ER_ID"), _
childColumn:=ds.Tables("Thickness").Columns("ER_ID"), _
createConstraints:=False))
'Bind the DataTable to the ComboBox
ComboBox1.DataSource = ds
ComboBox1.DisplayMember = "ER"
'Bind the DataTable to the ComboBox
ComboBox2.DataSource = ds
ComboBox2.DisplayMember = "ER.relERThickness"
Catch exp As Exception
MsgBox(exp.Message)
Finally
If Not odr Is Nothing Then
odr.Close()
End If
If Not cmd Is Nothing Then
da1.Dispose()
da2.Dispose()
End If
If Not cnn Is Nothing Then
cnn.Dispose()
End If
End Try
End Sub
|
|
|
|
|
Begin PART 1 :
I have a sub
Private Sub PrintProperties(Of T)(ByVal pItem As T)
[...]
End Sub that I need to access it through MethodInfo :
Private Sub PrintPropertiesMaster(Of T)()
[...]
Dim method As MethodInfo = GetType(Form1).GetMethod("PrintProperties", _
(System.Reflection.BindingFlags.Instance _
Or (System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.NonPublic)), _
Nothing, New Type() {GetType(T)}, Nothing)
[...]
End Sub but method is set to nothing after the previous line.
I'm sure I miss something in the Type.GetMethod parameters. Any idea?
End PART 1
Begin PART 2 :
Another way to achieve my goal could be to know how to specify a TypeParam dynamically.
Let me explain this with sample :
This is my not conforming code:
For Each oEnt As Entity In DefaultManager.GetEntities(Of SomeNameSpace.ObjOne)()
PrintProperties(Of SomeNameSpace.ObjOneDataRow)(CType(oEnt, SomeNameSpace.ObjOneDataRow))
Next
For Each oEnt As Entity In DefaultManager.GetEntities(Of SomeNameSpace.ObjTwo)()
PrintProperties(Of SomeNameSpace.ObjTwoDataRow)(CType(oEnt, SomeNameSpace.ObjTwoDataRow))
Next
'And so on
[...] I need to access it using a System.Type instead of TypeParam (Of Something )
(Consider that ObjOne Inherits from ObjOneDataRow and ObjTwo Inherits from ObjTwoDataRow.
In other words, ObjOneDataRow is the base class of ObjOne)
So one parameter should be enough to know all the needed System.Type to finish with something like this :
Private Sub PrintValues(Of T)()
For Each oEnt As Entity In DefaultManager.GetEntities(Of T)()
PrintProperties(Of GetType(T).BaseType)(CType(oEnt, GetType(T).BaseType))
Next
End Sub but this does not compile
End PART 2
Thanks for any help!!!
|
|
|
|
|
I get the error: "Invalid Parameter Used" when i try to display an image
I believe this occurs at DisplaySignPictureBox.Image = Image.FromStream(mem)
Try
Connect()
jesacmd = New SqlCommand("SELECT PER_SIGN FROM PER_INFO_SIGN WHERE PER_NAME
= '" & CheqOwnerComboBox.SelectedItem.ToString & "'", jesacon)
Dim da As New SqlDataAdapter(jesacmd)
Dim ds As New DataSet
da.Fill(ds, "PER_INFO_SIGN")
Dim c As Integer = ds.Tables("PER_INFO_SIGN").Rows.Count
If c > 0 Then
Dim jbyte() As Byte = ds.Tables("PER_INFO_SIGN").Rows(c - 1)("PER_SIGN")
Dim mem As New MemoryStream(jbyte)
DisplaySignPictureBox.Image = Image.FromStream(mem)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
jesacon.Close()
modified on Tuesday, September 23, 2008 9:58 AM
|
|
|
|
|
In VB6 i want to display the dollar,pund and euro depending on the countries.I am using "SetLocaleInfo" function .I am having the error like "function not defined" .Please tell me how to define this function.thanks in advance
----------------------------------------------------------
Dim IntLocale As Integer
IntLocale = SetLocaleInfo(2057, 1, "H")
If (CurrCntryCode = "EP") Then
xlApp.ActiveSheet.Range("J" & NxtLine).NumberFormat = "€#,##0.00"
Else
If (CurrCntryCode = "HK") Then
xlApp.ActiveSheet.Range("J" & NxtLine).NumberFormat = "$#,##0.00"
Else
If (CurrCntryCode = "UK") Then
xlApp.ActiveSheet.Range("J" & NxtLine).NumberFormat = "£#,##0.00"
Else
xlApp.ActiveSheet.Range("J" & NxtLine).NumberFormat = "£#,##0.00"
GridFormatCellFunction("J" & NxtLine) = "Format,£#,##0.00"
End If
End If
End If
|
|
|
|
|
You're getting the message "function not defined" because you haven't defined SetLocaleInfo anywhere in your code.
|
|
|
|
|
Hi friends,
Can anyone tell me how to print current document using VB.net 2005.
Also tell me how can I format a report..
Thanks...
|
|
|
|
|
Hi, I need to convert Topographic Map/ Contour Map into another view like the image shown below in VB.net. The value of each contour line will be input by user which will be the value of Y. What I need is the way to extract the point which will be the value of X.
Sorry that I do not know how to describe the view I want to convert to.
Can anyone give me idea how to get it done?
|
|
|
|