|
I'm surprised, I'd have expected you could do this.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi christian.
i thought that too.
steffen.
|
|
|
|
|
Are you absolutely sure the Product class Implements IGridMarkable??
|
|
|
|
|
hello dave.
see for yourself (i shortened it down to the necessary things)
Public Interface IGridMarkable
ReadOnly Property sort() As Short
Property valid() As SqlBoolean
ReadOnly Property must() As Boolean
End Interface
Public Class product
Implements IGridMarkable
#Region "private member vars"
Private _sort As Long
Private _valid As SqlBoolean = SqlBoolean.Null
Private _must As Boolean
#End Region
#Region "properties"
Public ReadOnly Property sort() As Short Implements IGridMarkable.sort
Get
Return Me._sort
End Get
End Property
Public ReadOnly Property must() As Boolean Implements IGridMarkable.must
Get
Return _must
End Get
End Property
Public Property valid() As SqlBoolean Implements IGridMarkable.valid
Get
Return _valid
End Get
Set(ByVal value As SqlBoolean)
#If DEBUG Then
Debug.WriteLine("Produkt: " + Me.sort.ToString + " valid: " + value.ToString)
#End If
_valid = value
End Set
End Property
#End Region
End Class
Could it be that the problem lies in trying to cast the collection instead of one single product?
steffen.
|
|
|
|
|
OK. I just tried this and it failed. I, too, would have thought this should have worked.
Hmmm.... still playing around with this one.
OK. It looks like you're going to have to create the list Dictionary using IGridMarkable , not Product :
Dim list As New Dictionary(Of Short, IGridMarkable)
list.Add(some short, New Product())
someClass.setRef(list)
The type cast won't work because the Dictionary is, internally, a collection of KeyValuePair(Of type, type) objects, which the type cast won't transfer to.
|
|
|
|
|
i'll try this when i'm back at work. my problem is that i work with this dictionary application wide, where the IGridMarkable-propertys of the product are changed. But I need the "normal" product propertys too. Maybe I could just make another Dictionary(of short, IGridMarkable) where i add references to the real products, but this is a waste of memory.
well, thank you, i'll go home now.
|
|
|
|
|
hello all.
i won't be at work the next 2 weeks, so don't be suprised if i don't answer.
thank you for your efforts.
steffen.
|
|
|
|
|
Working in VB.Net, Visual Studio 2000 Standard, Windows XP Pro.
Using a 3rd party video editor ActiveX control.
Have 3 forms in the program using this control. First time one of the forms is opened, the ActiveX control performs correctly. After the form is closed, attempting to open any of the 3 forms with this control throws an exception error:
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in system.windows.forms.dll
Additional information: Unable to get the window handle for the 'AxVideoEdit' control. Windowless ActiveX controls are not supported.
The line in the program VisualStudio stops at is located in the "Windows Form Designer generated code" section for the details on the form being opened:
CType(Me.vidEdit, System.ComponentModel.ISupportInitialize).EndInit()
(vidEdit is the VideoEdit ActiveX control)
Following is the error message details when running the actual program:
************************************************
************************************************
************************************************
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Reflection.TargetInvocationException: Unable to get the window handle for the 'AxVideoEdit' control. Windowless ActiveX controls are not supported. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.IOleObject.DoVerb(Int32 iVerb, IntPtr lpmsg, IOleClientSite pActiveSite, Int32 lindex, IntPtr hwndParent, COMRECT lprcPosRect)
at System.Windows.Forms.AxHost.DoVerb(Int32 verb)
at System.Windows.Forms.AxHost.InPlaceActivate()
--- End of inner exception stack trace ---
at System.Windows.Forms.AxHost.InPlaceActivate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at MyProgram.VidEdit.InitializeComponent()
at MyProgram.VidEdit..ctor()
at MyProgram.StartProgram.lblClipEdit_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
ActionPlusVideo
Assembly Version: 1.0.2980.30757
Win32 Version: 1.0.2980.30757
CodeBase: file:///C:/Program%20Files/MyProgram/MyProgram.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
AxInterop.VIDEOEDITLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/MyProgram/AxInterop.VIDEOEDITLib.DLL
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.3300.0
Win32 Version: 7.00.9466
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.3300.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
Interop.VIDEOEDITLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/MyProgram/Interop.VIDEOEDITLib.DLL
----------------------------------------
AxInterop.MOVIEPLAYERLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/MyProgram/AxInterop.MOVIEPLAYERLib.DLL
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
************************************************
************************************************
************************************************
Have tried using the forms with and without vidEdit.Dispose(), MyBase.Dispose(), etc., but no success.
Any suggestions?
|
|
|
|
|
Sounds like it's not supported. What control do you use ? I use the Datastead TVideoGrabber, and it's worked out really well, and their support is excellent.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Using Viscom's VideoEdit ActiveX.
The error report shows there is no instance of the ActiveX control to access, but it works fine the first time through. The com wrapper is being lost somehow when closing the form and not being reproduced when another instance of the ActiveX control is called for. Any answers on why this could be happenning and how to prevent it?
|
|
|
|
|
No, but I'd say the authors of your component are the best folks to ask.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I want to exit a for each loop early. How do I do that.
Here is my loop? Some code from inside the loop is missing.
For Each row As DataRow In dtGetLid.Rows
dtCkLessStat.Clear()
Call checkLessonStatus(Convert.ToInt32(row("less_id")), dtpText)
Next
Can I put it in a function and then exit the function when the loop finds a particular condition?
How do I exit the function?
|
|
|
|
|
In C#, you put the break keyword to exist a loop. Not sure if it works for foreach, or if the syntax is the same in VB. I wouldn't use foreach unless I intended to iterate over them all. I'd use a for loop for that, or better yet, a while loop that can be set up to break naturally, without a break statement inside the loop.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
The break keyword does not work in VB.NET. Would it work to clear the dataTable?
|
|
|
|
|
Then there is probably another word in VB. However, a while loop is the nicest solution.
Would what work ? The break keyword won't cleay anything, and any sort of loop is going to run the code inside the loop.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am not sure, but if I understand your problem you just need something to exit FOR loop.
You can use Exit For for this.
"Legacy code" often differs from its suggested alternative by actually working and scaling.
—Bjarne Stroustrup
|
|
|
|
|
hi
how i can display the relation betwwen tables in the datagridview control;
|
|
|
|
|
I have a VB.NET VS2008 windows form application where I have a crystalviewer form setup to print a few reports out from the menu off of the main data entry form.
The crystal reports are already written and stored in a folder on one of our servers (For this example lets call it \\MyServer\ReportFolder\). The crystal report uses a DSN to know where to find the data (For this example lets call it MyCrystalDSN).
The code on the menu fires off the report as shown below:
Dim frmCV As New frmCrystalViewer
frmCV.CrystalReportViewer1.ReportSource = "\\MyServer\ReportFolder\Reportname.rpt"
frmCV.WindowState = FormWindowState.Maximized
frmCV.ShowDialog()
Ok, everything works great for now, but of course it never fails that when you develop at your desk with all the rights available as a developer it all works and when you deploy the app, everything never works as planned.
When I publish the project for use by the client, I have to setup a DSN so the Crystal Reports will work.
Can I do this on the fly with code? For example, my crystal reports are using the MyCrystalDSN, and I don't want to have to remember to setup a DSN for everyone's computer I deploy the application on. Can I code the DSN information to use in the code prior to firing off the report?
A coworker gave me the following code from an article that I believe was written in 2001 for VB6. Is anyone doing this in .NET? Here is that code:
Public Sub RegisterDatabaseSample()
'Create a DSN called TEST on a server called ThatServer
DBEngine.RegisterDatabase "TEST", "SQL Server", True, _
"Database=pubs" & _
vbCr & "Description=Sample DSN" & _
vbCr & "Server=ThatServer"
End Sub
Any help is appreciated
Lost in the vast sea of .NET
|
|
|
|
|
I've been searching for the solution on the web and found a few different suggestions which I combined and came up with the answer to my question.
Here is the code:
Public Declare Auto Function SQLConfigDataSource Lib "ODBCCP32.DLL" _<br />
(ByVal hwndParent As Integer, ByVal fRequest As Integer, _<br />
ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer<br />
<br />
Private Const ODBC_ADD_SYS_DSN As Integer = 4<br />
<br />
<br />
Private Sub Create_DSN_For_Crystal_Reports()<br />
Try<br />
Dim attributes As New System.Text.StringBuilder()<br />
Dim returnCode As Integer<br />
<br />
attributes.Append("DSN=MyCrystalDSN")<br />
attributes.Append(Chr(0))<br />
attributes.Append("Server=MyDBServer")<br />
attributes.Append(Chr(0))<br />
attributes.Append("Description=DSN added via code from My VB App")<br />
attributes.Append(Chr(0))<br />
attributes.Append("Database=MyDatabase")<br />
attributes.Append(Chr(0))<br />
attributes.Append("AnsiNPW=Yes")<br />
attributes.Append(Chr(0))<br />
attributes.Append("QuotedId=Yes")<br />
attributes.Append(Chr(0))<br />
attributes.Append("Trusted_Connection=Yes")<br />
attributes.Append(Chr(0))<br />
attributes.Append(Chr(0))<br />
<br />
returnCode = SQLConfigDataSource(0&, ODBC_ADD_SYS_DSN, "SQL Server", attributes.ToString)<br />
<br />
If returnCode <> 1 Then<br />
Throw New Exception("DSN could not be setup to allow Crystal Reports access")<br />
End If<br />
Catch ex as Exception<br />
msgbox(ex.message)<br />
End Try<br />
End Sub
Hopefully posting the answer will help someone else later who has the same problem.
Lost in the vast sea of .NET
modified on Thursday, March 6, 2008 8:45 AM
|
|
|
|
|
You can create a typed dataset, get the data yourself via ADO.net and then supply the report with the loaded type dataset and then you don't need a DSN for Crystal. A developer I work with has used this technique in the past. I haven't tried it yet.
http://support.microsoft.com/kb/320714
http://www.gridviewguy.com/ArticleDetails.aspx?articleID=201_Creating_Crystal_Reports_Using_Typed_DataSet
|
|
|
|
|
Thanks for the feedback. I'm actually using the technique you suggested in several other projects and yes it works great. With the project I'm currently working on, they want me to fire off already created Crystal Reports from my VB application which uses a preset DSN.
Thanks again for you response!
Lost in the vast sea of .NET
|
|
|
|
|
Oh I see - yeah, that's too bad - that's our current situation too - forced to use the DSN way due to the reports being developed that way. I'm too lazy to look into it, but perhaps with the Developer edition of CR someone could modify the data source part on the fly and convert it to accept data through a typed set instead of DSN's.
|
|
|
|
|
Hi all!
I have a question:
It's possible to reading all data received from port 80 (HTTP) in VB.NET?
I have tried but without success
Thanks, and sorry for my bad English
|
|
|
|
|
Hi,
I'm using VB6 with Crystal Reports 8.5 ActiveX Designer Run Time Library
I am trying to add a new section to the report at runtime.
I'm using the following code:
(CRXReport is defined as: CRAXDRT.Report)
<br />
Dim CrSection As CRAXDRT.Section<br />
Set CrSection = CRXReport.Sections.Add()<br />
I get the "Invalid procedure call or argument" error, I also get it when I use:
<br />
Set CrSection = CRXReport.Sections.Add(index)
When I just get an existing section it works
<br />
Set CrSection = CRXReport.Sections(index)<br />
Any ideas why this isn't working and how to solve this?
thanks.
|
|
|
|
|
Hi,
I am working on a vb.net app in which i need to use the transparency key property. Yet, all of a sudden, i cant get it to work. I have a panel on a mdi child form. I have set the righttoleftlayout property to false and also set the resolution of my screen to 16 bit (as the microsoft site says there is a bug with depth over 24 bit). I even tried putting the panel in the mdiparent and fiddling around with the colours and setting the parent's righttoleft property to false. It still doesnt work. Any ideas?
Thanks,
Ahmad
|
|
|
|