|
Hi,
I need to write a Add function within a class to add to complex Numbers,
So far I have two variables in a class called ComplexNo
Private frealpart As single
Private fimagpart As Single
Representing the real part and imaginary part of the complex Number
A variable in the form event. I.e. ocomplex as new ocomplexNo (4,5)
Returns the values to the Variables in the class 4 real and 5 imaginary
File constructor in the class is ….
Sub New ( fpart as single, ipart as single)
frealpart = fpart
fimagpart = fipart
End sub
I need to create a new variable called ocomplex2 as new (4,6) and use a function to add these values to the class variables above.
I would like to
ocomplex.Add(ocomplex2) thus returning the values to the class.
Hope this makes sense to someone
Thank you in Advance
|
|
|
|
|
Hi!
I have an app that does async. reads from a networkStrem.When i do BeginRead() i pass an object(which is kept in a collection) that includes info about the connection and the networkstream.When the application enters the callback method the object has changed(the network stream already contains the info?) or does it change only after the EndRead() when i read data from the networkStream? Is the EndRead method Thread-safe?I ask this because if it isn't thread-safe then the collection is changing without any sync. method and i use synclock whenever i'm accessing the collection... Thanks in advance.
|
|
|
|
|
:->1) Resource transformation for file "tgif_resx" failed. type is not resolved for member Crystaldecisions.ReportAppServer.InternalEnterpriseLogonInfo.CrystalDecisions.CrystalReports.Engine, Version=10.0.3300.0, culture=Neutral,PublicKey Token=692fbea5521e1304
2) D:\CTC\ctc\TGIIMS 041213a\TGIIMS 041213a code\tgif_Report.vb(46): 'FileName' is not a member of 'CrystalDecisions.CrystalReports.Engine.ReportDocument'.
Regards
Abhijeet
|
|
|
|
|
How To Stretch Picture Box Manually at Run Time in VB.Net. its Urgent.
|
|
|
|
|
I'd like to use 2 comboboxes in my application that views Crystal Reports. My report is a inventory of available material at different warehouse locations. The report needs 2 parameters (from location) and (to location). Essentially I can query inventory from a location (from New York to New York).
My combo boxes alone work fine with the Crystal report viewer but when used together only the second combo box works (to location). As a result I'm promted to add the value for the (to location) a second time.
I want the have my program pass both of the "to" and "from" information from the combo boxes directly into the Crystal report viewer.
Here's the code that I have thus far.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim myParameterFields As New ParameterFields<br />
Dim myParameterField As New ParameterField<br />
Dim myDiscreteValue As New ParameterDiscreteValue<br />
<br />
myParameterField.ParameterFieldName = "location_from"<br />
myDiscreteValue.Value = ComboBox1.Text<br />
myParameterField.CurrentValues.Add(myDiscreteValue)<br />
<br />
myParameterField.ParameterFieldName = "location_to"<br />
myDiscreteValue.Value = ComboBox2.Text<br />
myParameterField.CurrentValues.Add(myDiscreteValue)<br />
<br />
myParameterFields.Add(myParameterField)<br />
<br />
CrystalReportViewer1.ParameterFieldInfo = myParameterFields<br />
<br />
CrystalReportViewer1.ReportSource = New Lager_best_XL<br />
CrystalReportViewer1.Refresh()<br />
<br />
<br />
End Sub
|
|
|
|
|
i didn't check it coz i didn't have dotnet Installed currently. but i think it will slove ur problem
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myParameterFields As New ParameterFields
Dim myParameterField As New ParameterField
Dim myDiscreteValue As New ParameterDiscreteValue
myParameterField.ParameterFieldName = "location_from"
myDiscreteValue.Value = ComboBox1.Text
myParameterField.CurrentValues.Add(myDiscreteValue)
myParameterFields.Add(myParameterField) // Add This line of Code
myParameterField.ParameterFieldName = "location_to"
myDiscreteValue.Value = ComboBox2.Text
myParameterField.CurrentValues.Add(myDiscreteValue)
myParameterFields.Add(myParameterField)
CrystalReportViewer1.ParameterFieldInfo = myParameterFields
CrystalReportViewer1.ReportSource = New Lager_best_XL
CrystalReportViewer1.Refresh()
End Sub
|
|
|
|
|
Thanks I tried out your suggestion of adding in the extra line of code (myParameterFields.Add(myParameterField) after the first combo box definition but the same problem still persists. No debugging problems were created with the new line of code.
|
|
|
|
|
It May Not seem a good awnser but its the best i can give without testing.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myParameterFields As New ParameterFields
Dim myParameterField As New ParameterField
Dim myParameterField1 As New ParameterField
// the value for location_from is seem to be replaced by location_to and it can
//be tested by saving there values into two different objects.
Dim myDiscreteValue As New ParameterDiscreteValue
Dim myDiscreteValue1 As New ParameterDiscreteValue
myParameterField.ParameterFieldName = "location_from"
myDiscreteValue.Value = ComboBox1.Text
myParameterField.CurrentValues.Add(myDiscreteValue)
myParameterFields.Add(myParameterField) // Add This line of Code
myParameterField1.ParameterFieldName = "location_to"
myDiscreteValue1.Value = ComboBox2.Text
myParameterField1.CurrentValues.Add(myDiscreteValue1)
myParameterFields.Add(myParameterField1)
CrystalReportViewer1.ParameterFieldInfo = myParameterFields
// also its has been a while since i did it but i remember there is a way to pass
//the string to CrystalReportViewer or New Lager_best_XL directly like this
//New Lager_best_XL.METHODNAME="Location_from>='' and Location_to = <=" //etc...
//or
//CrystalReportViewer.METHODNAME="Location_from>='' and Location_to = <=" //etc...
//i don't remember the method name coz it has been a while but at that time i used it
//to get a report inbetween two dates.
CrystalReportViewer1.ReportSource = New Lager_best_XL
CrystalReportViewer1.Refresh()
End Sub
|
|
|
|
|
I tried your suggestion of sending the outputs from the combo boxes to different objects. I inserted a second crystal report viewer and a second button. I have the (location from) combo box sent to the new report viewer. The (location to) combo box still uses the original report viewer.
As predicted when running the using the original report viewer I'm prompted for the for (location from) information. Likewise when I use the new report viewer I'm prompted for (location to) information.
The combo boxes are both doing their jobs it's just that the last passed value is taken or the first value is over witten from the second either way same result.
|
|
|
|
|
well i didn't say u use two different report viewer i said u use two different myParameterField Object Then Add Them To myParameterFields The Code Will Look Like This
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myParameterFields As New ParameterFields
Dim myParameterField As New ParameterField
Dim myParameterField1 As New ParameterField
Dim myDiscreteValue As New ParameterDiscreteValue
Dim myDiscreteValue1 As New ParameterDiscreteValue
myParameterField.ParameterFieldName = "location_from"
myDiscreteValue.Value = ComboBox1.Text
myParameterField.CurrentValues.Add(myDiscreteValue)
myParameterFields.Add(myParameterField)
myParameterField1.ParameterFieldName = "location_to"
myDiscreteValue1.Value = ComboBox2.Text
myParameterField1.CurrentValues.Add(myDiscreteValue1)
myParameterFields.Add(myParameterField1)
CrystalReportViewer1.ParameterFieldInfo = myParameterFields
CrystalReportViewer1.ReportSource = New Lager_best_XL
CrystalReportViewer1.Refresh()
End Sub
Hope Fully It Will Work
|
|
|
|
|
I tried your suggestions but when I run the program I get an error message of "invalid pointer" and the report doesn't display at all.
Here's a copy of what I added:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim myParameterFields As New ParameterFields<br />
Dim myParameterField As New ParameterField<br />
Dim myParameterField1 As New ParameterField<br />
<br />
Dim myDiscreteValue As New ParameterDiscreteValue<br />
Dim myDiscreteValue1 As New ParameterDiscreteValue<br />
<br />
myParameterField.ParameterFieldName = "Lagerort_von"<br />
myDiscreteValue.Value = ComboBox1.Text<br />
myParameterField.CurrentValues.Add(myDiscreteValue)<br />
<br />
myParameterFields.Add(myParameterField)<br />
<br />
myParameterField.ParameterFieldName = "Lagerort_bis"<br />
myDiscreteValue.Value = ComboBox2.Text<br />
myParameterField1.CurrentValues.Add(myDiscreteValue1)<br />
<br />
myParameterFields.Add(myParameterField1)<br />
<br />
CrystalReportViewer1.ParameterFieldInfo = myParameterFields<br />
CrystalReportViewer1.ReportSource = New Lager_best_XL<br />
CrystalReportViewer1.Refresh()<br />
<br />
<br />
End Sub
|
|
|
|
|
|
If your printing raw text, then you'll have to consult with the printers manual and send the appropriate ESC codes to the printer, just like you do text, to get it to change the font, bold, italics, size, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
hi
i wish to add a value to date
example
1/1/2005 add 4 days ahead
so the date will be 5/1/2005
may i know how to do this by code?
i try this way
dim a as date
a= today +4
but there is an error here state that + cannot be done by date n integer
may i know how to add it to date?
thank you in advance
Gary
|
|
|
|
|
You can add DateTime and TimeSpan:
<br />
DateTime nowPlusFourHours = DateTime.Now + new TimeSpan(4, 0, 0, 0)<br />
You can also substract one DateTime from another one and get a TimeSpan back.
|
|
|
|
|
hi robert
i dont understand......
DateTime?
i try typing it
it say here
DateTime is a type and cannot be used as an expression
so i try this way
Dim a As Date<br />
a = DateTime.Now + New TimeSpan(4, 0, 0, 0)
but ending up it say
operator "+" is not define for "Date" and "TimeSpan"
can please explain in more detail?
im using vb.net
thanks
Gary
|
|
|
|
|
You are right, sorry. Sometimes I mix up C# and VB.Net
You should use:
<br />
Dim a As Date<br />
a = DateTime.Now.Add(New TimeSpan(4, 0, 0, 0))<br />
|
|
|
|
|
There is also
DateTime.Now.AddDays(4)
|
|
|
|
|
How does one retreive the directory path of a specific file chosen once you click on ok button on an openfiledialog? e.g. C:\test\data\textfile.txt
Thanks
|
|
|
|
|
Not sure what you mean. With the properties FileName and FileNames you can get the complete path from the OpenFileDialog - including the filename itself. If you only want the directory you can use System.IO.Path.GetDirectoryName function to remove the filename from a complete filepath.
|
|
|
|
|
Thanks the filenames works.
|
|
|
|
|
Hello,
I'm new on this page and on VB.Net and want's to create an simple control. But for this I need a property with DataType is collection. In the collection I want to have an object with two properties ('Prop' and 'Value'). I have defined this property, but VB.Net doesn't save my edits in the built in CollectionEditor.
At the Control I have inserted the following code:
<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)> _<br />
Public ReadOnly Property CustomProperties() As CustomPropertyCollection<br />
Get<br />
Return mvcolCustomPropertyCollection<br />
End Get<br />
End Property<br />
The definition of the CustomPropertyCollection and the object in the collection is:
Friend Class CustomPropertyConverter<br />
' Ohne den Konverter kann man nicht speichern<br />
Inherits System.ComponentModel.TypeConverter<br />
<br />
Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destType As Type) As Boolean<br />
If destType Is GetType(System.ComponentModel.Design.Serialization.InstanceDescriptor) Then<br />
Return True<br />
End If<br />
<br />
Return MyBase.CanConvertTo(context, destType)<br />
End Function<br />
<br />
Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destType As Type) As Object<br />
If destType Is GetType(System.ComponentModel.Design.Serialization.InstanceDescriptor) Then<br />
Dim cat As CustomProperty = DirectCast(value, CustomProperty)<br />
<br />
Dim ci As System.Reflection.ConstructorInfo = GetType(CustomProperty).GetConstructor(System.Type.EmptyTypes)<br />
<br />
Return New System.ComponentModel.Design.Serialization.InstanceDescriptor(ci, Nothing, False)<br />
End If<br />
<br />
Return MyBase.ConvertTo(context, culture, value, destType)<br />
End Function<br />
End Class<br />
<br />
<System.ComponentModel.TypeConverter(GetType(CustomPropertyConverter))> _<br />
Public Class CustomProperty<br />
Dim mvstrProperty As String<br />
Dim mvstrValue As String<br />
<br />
Public Property Prop() As String<br />
Get<br />
Prop = mvstrProperty<br />
End Get<br />
Set(ByVal pvstrProp As String)<br />
mvstrProperty = pvstrProp<br />
End Set<br />
End Property<br />
<br />
Public Property Value() As String<br />
Get<br />
Value = mvstrValue<br />
End Get<br />
Set(ByVal pvstrValue As String)<br />
mvstrValue = pvstrValue<br />
End Set<br />
End Property<br />
End Class<br />
<br />
Public Class CustomPropertyCollection<br />
Inherits CollectionBase<br />
<br />
'Needed to implement the strongly-typed collection<br />
Default Public Property Item(ByVal Index As Integer) As CustomProperty<br />
Get<br />
Return DirectCast(List.Item(Index), CustomProperty)<br />
End Get<br />
Set(ByVal Value As CustomProperty)<br />
List.Item(Index) = Value<br />
End Set<br />
End Property<br />
<br />
Public Function Add(ByVal Item As CustomProperty) As Integer<br />
Return List.Add(Item)<br />
End Function<br />
<br />
Public Sub Insert(ByVal index As Integer, ByVal Item As CustomProperty)<br />
If List.Contains(Item) Then<br />
Throw New InvalidOperationException("Already in list.")<br />
End If<br />
<br />
List.Insert(index, Item)<br />
End Sub<br />
<br />
Public Function Contains(ByVal value As CustomProperty) As Boolean<br />
Return List.Contains(value)<br />
End Function<br />
<br />
'Redraw the control<br />
Protected Overrides Sub OnClearComplete()<br />
MyBase.OnClearComplete()<br />
End Sub<br />
<br />
'Redraw the control and wire up button's redrawneeded event<br />
Protected Overrides Sub OnInsertComplete(ByVal index As Integer, ByVal value As Object)<br />
MyBase.OnInsertComplete(index, value)<br />
End Sub<br />
<br />
'Redraw the control<br />
Protected Overrides Sub OnRemoveComplete(ByVal index As Integer, ByVal value As Object)<br />
MyBase.OnRemoveComplete(index, value)<br />
End Sub<br />
End Class<br />
The Part with the Converter I have seen in a sample for this page (outlookbartest). I don't know if I need it...
Please help me...
Vocaris
|
|
|
|
|
I have a datagrid with 6 columns. column 6 is the balance column and column 4 is the amount payed.I need column4 row1 to subtract from column6 row1 and show in row2 column6.then I need column4 row2 to subtract from column6 row2 and show in column6 row3. I need this to loop or something.
any suggestions?
|
|
|
|
|
Not sure if that is what you need but sounds like:
for index=1 to datagrid.count-1
datagrid.rows(index).item("Column6")=datagrid.rows(index-1).item("Column6")-datagrid.rows(index).item("Column4")
next index
Briga
|
|
|
|