|
Christian Graus wrote: ( static in C# and C++ )
and C and Java and Pascal and...
---
b { font-weight: normal; }
|
|
|
|
|
Hi, does anyone know what this error means and how I can resolve the issue? I have created a UFL for crystal reports in VS2005 and have created the assembly etc. It works fine in preview report, but when I load the program and try to load the report from the viewer it gives me the error:
"NonComVisibleBaseClass was detected
Message: A QueryInterface call was made requesting the default IDispatch interface of COM visible managed class 'CRUFL_VB_ReportFunctions.CrystalReport1'. However since this class does not have an explicit default interface and derives from non COM visible class 'CrystalDecisions.CrystalReports.Engine.ReportClass', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules."
I have done some research online to find that the problem might be the MDA, I added the MDA key as described and set it to 0 but am still having problems with mda issues during the build and run within visual studio. Runs fine if I use the exe in the bin folder.
Any ideas? thank you
eatwork
|
|
|
|
|
Hi,
The code below should use the adodc control to retrieve data from the table and display them in textboxes.
In the contrary this error:object does not support named arguments was returned on
rctcon.recordsource= "select * from mytable" section of my code.
Dim rctcon as connection<br />
rctcon.connectionstring=MYstring<br />
rctcon.recordsource= "select * from mylist"<br />
set txtpolicy.datasource= rctcon<br />
txtpolicy.datafield="policyno"
Please how am I to use the adodc to display data in my textboxes.
thanks
Fikunmi Feyijin
Hicad Systems
Nigeria
|
|
|
|
|
Are you really sure that the code that produces that error message looks like that? It doesn't really make any sense, as you are not using any named arguments in the query.
---
b { font-weight: normal; }
|
|
|
|
|
hi there,
i`m really new to .Net and need help with a problem.
i have to send commands to the serial port to which a rfid-card-reader is connected. depending on the command, the card-reader send the answer back to the serial port. my problem is that the first 3 or sometimes 4 commands are working but the following end up in incorrect answers.
the problem has to stuck somewhere in my program because the reader is working fine with another program and the commands are correct.
the connection i build up with the following code
<br />
Private Sub connection()<br />
<br />
mySerial = New SerialPort("COM9", 9600, IO.Ports.Parity.None, 8, IO.Ports.StopBits.One)<br />
mySerial.Encoding = System.Text.Encoding.GetEncoding(1252)<br />
mySerial.Open()<br />
<br />
End Sub
in my main program i write the command in an byte array.
example:
<br />
Dim buffer1 As Byte() = {&H2, &HB0, &HB2}<br />
sending(buffer1)
before i use the function sending to send the bytes to the serial port
<br />
Private Sub sending(ByVal buffer As Byte())<br />
<br />
Dim i As Integer<br />
<br />
Dim count = buffer(0) 'buffer(0) includes the number of the following bytes<br />
<br />
'Here i want to write byte by byte to the com port<br />
<br />
For i = 0 To count <br />
mySerial.Write(Chr(buffer(i)))<br />
Next<br />
<br />
End Sub
after this i use a threading.thread.sleep() in my main program before i use the following function to read from the com-port
<br />
Private Function reading() As Byte()<br />
<br />
Dim readbuffer As Byte() = {}<br />
<br />
'setting the readbuffer to the size of bytes it has to read from the port<br />
<br />
ReDim readbuffer(mySerial.BytesToRead() - 1) <br />
<br />
'read bytes from the serial port<br />
<br />
mySerial.Read(readbuffer, 0, mySerial.BytesToRead) <br />
<br />
reading = readbuffer<br />
<br />
End Function
As i said the first read / write attemps work fine but after a few times i get wrong answers but the command is definitly correct.
is there something i make wrong while opening the connection or do i have to send the bytes an other way?
thanks for your help
michael
|
|
|
|
|
belowzero wrote: mySerial = New SerialPort("COM9", 9600, IO.Ports.Parity.None, 8, IO.Ports.StopBits.One)
First, verify that these parameters are correct. Compare them with the parameters the your other application is using.
belowzero wrote: mySerial.Encoding = System.Text.Encoding.GetEncoding(1252)
Why are you setting an encoding if your supplying the bytes to be sent out the port? The encoding will translate any text characters, thereby possibly screwing up your data as it goes out to and comes back from the RFID reader. Leave it at the default of ASCII.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi, thanks for your answer.
the parameters i got from one of our engineers so i think they are ok.
the encoding setting i also became from him, but i`ll try it without the encoding tomorrow.
i first wanted to try the programm tonight at home but unfortunately i forgot that my notebook has no serial port is there any way to simulate a serial port?
thanks michael
|
|
|
|
|
belowzero wrote: the parameters i got from one of our engineers so i think they are ok.
The first rule of troubleshooting: There is no "thinking" allowed. You either know it or you don't. You either know you've tested and verified it, or you need to test and verify it.
belowzero wrote: is there any way to simulate a serial port?
Uh, without on ACTUAL serial port, how are you going to connect the RFID reader?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
at work i have a serial port only @home i don`t have one.
|
|
|
|
|
i found the problem. the timeout of the card reader was set to 40ms. i don`t know why, but the communication between my .net program, the serial port and the card reader needed a higher timeout.
|
|
|
|
|
Hi, I'm writing an application and I'm attempting to create a TableLayoutPanel and add/remove columns dynamically. However, I can't locate the method/ability to do so.
Is it possible to add columns to a TableLayoutPanel dynamically? If so, could you provide a small snippet?
Thanks!
|
|
|
|
|
Yeah, all you need to do is change the ColumnCount and RowCount properties. Also, check the documentation on the GrowStyle property to control automatic row or column add/delete. Once that's set, you'll have to create new ColumnStyles and/or RowStyles to define the column/row layouts and add them to the ColumnStyles and RowStyles collections.
TLP1.ColumnCount = 1
TLP1.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 100.0))
TLP1.RowCount = 2
TLP1.RowStyles.Add(New RowStyle(SizeType.Percent, 15.0))
TLP1.RowStyles.Add(New RowStyle(SizeType.Percent, 85.0))
When that's done, you can add controls to the new rows and columns with the TLP's Controls collection. You need to specify which column and row the control is going to end up in (0 based!) So, in the above example, the first (and only) column is 0, and the rows are 0 and 1.
TLP1.Controls.Add(TextBox1, 0, 0)
TLP1.Controls.Add(TextBox2, 0, 1)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you so much! That worked like a charm!
|
|
|
|
|
I have a few questions about the .NET Delegate. It seems like the delegate is consumed to change a value on the delegate's source form. My problem is, is that I need to change about 50 values (set them to blank). This (setting up a delegate) doesn't seem like the way to go about consuming an event that just merely changes textboxes to be blank. I don't need to return any value from form 1, but just fire the event.
Christian Graus: i've seen you reply to a few people's questions with the simple line 'use a delegate' or something to that effect. Just wondering what your take is on this situation.
Nathan Lindley
.NET Aficionado
-- modified at 11:16 Wednesday 4th October, 2006
|
|
|
|
|
OK. What are you trying to do with this?
Are you just trying to clear a form from a seperate class?? If so, then it's bad practice to do it from your class. If your class knew anything about the form it's trying to modify, it would then be permanently tied to that form and not be able to be reused somewhere else.
What you should be doing is sending back data to the form that it knows should signal that some processing is done. This signal can then be used as a trigger so the form clears its own textbox's. This is either done with a return value from your class' method, or from an event or callback delegate that your form subscribes to.
With this model, your class can be reused with any UI, be it a Compact Framework app, ASP.NET app, Web Service, ...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks for the response Dave
Dave Kreskowiak wrote: an event or callback delegate that your form subscribes to
I've been trying to work with the delegate again all morning, and i'm just missing the connection (in my brain) somewhere. Heres what I have...
Form1(Modify2.vb)
Create the delegate:
Public Delegate Sub ClearDel(ByVal clear As Boolean)
Create the event:
Private evtClear As ClearDel
Public Sub Register(ByVal objClear As ClearDel)
'raise event here?
End Sub
Public Sub fireClear()
'clearing code
End Sub
Form2(frmPayableInfo)
Private WithEvents mobjModify2 As Modify2
In the sub where I process, at the end i have this:
mobjModify2 = New Modify2
mobjModify2.Register(New Modify2.ClearDel(AddressOf eventClear)
and then i have the sub:
Public Sub eventClear(ByVal clear As Boolean)
clear = True
End Sub
So now the question is, how do I hook up the fireClear() event on Form1(modify2.vb) with the delegate. And where would I set the condition for the delegate to fire? Thanks again for the response.
Nathan Lindley
.NET Aficionado
|
|
|
|
|
Wow! You've got everything backwards and in the wrong classes.
First of all, get off the delegate kick and start explaining what you're trying to do. Since you're using two forms, the circumstances have now changed.
Does Form1 show Form2 as a dialog and wait for the user to close Form2? If so, then all you have to do in Form2 is expose the data as a few properties and resume execution from after the ShowDialog call:
' In Form1
Dim myForm2 As New Form2()
' ShowDialog is a blocking call, so nothing after it will execute
' until the dialog is dismissed by the user.
If myForm2.ShowDialog() = DialogResult.OK Then
' Get the data off of Form2 and do something it...
Dim x As Integer = myForm2.someProperty
' Clear the textbox controls...
ClearMyControls()
End If
' When using ShowDialog(), you MUST call Dispose on the object
' when you're done with it!
myForm2.Dispose()
Now, if you're running both forms simultaneously, you can expose some events in Form2 that Form1 can subscribe to:
' In Form2
Public Event SomethingHappened(ByVal someValue As Integer)
Public Sub SomeMethod()
' Do something then raise an event to say it was done.
RaiseEvent SomethingHappened(data)
End Sub
' In Form1
Dim myForm2 As New Form2()
AddHandler myForm2.SomethingHappened, AddressOf MyHandler
.
.
' Must match the signature of the SomethingHappened event!
Private Sub MyHandler(ByVal value As Integer)
' We were told something happened. Clear our controls!
ClearMyControls()
End Sub
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks for the response Dave K
Like I said I am brand new to the whole delegate concept so I have no idea how they work. First let me just explain my situation. I have a form that displays a datagrid with customer info. when you double click the start of the row, it opens up a form (form2) that has a bunch of information based on the record that was clicked. When I submit this information (form2) I need to clear the datagrid (on form1) so that the user has to look up the ID of the person they updated (i probably should just reset the find, but thats another issue i can handle when i get this cross form communicating going), so there isn't old data. Okay. Now in your example:
Dave Kreskowiak wrote: ' In Form2
Public Event SomethingHappened(ByVal someValue As Integer)
Public Sub SomeMethod()
' Do something then raise an event to say it was done.
RaiseEvent SomethingHappened(data)
End Sub
What significance does the Integer in the argument have?
Nathan Lindley
|
|
|
|
|
nlindley7 wrote: What significance does the Integer in the argument have?
Nothing. It's just an example of how to pass data in an event.
If what you're doing in your datagrid is editing the details of that record and sending them back to the database, then you would probably show this detail form with ShowDialog(). After that statement returns (the user has finsihed editing this record and it was written back to the database), you can execute the code to refresh your datagrid's datasource.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hey Dave TA ,
The datagrid displays a list of claims for each client. When an individual claim is clicked, a new form pops up that displays the details of that particular claim. When you edit/submit the details of this form (form 2), the values are submittied to a claimsDetails table. One of the details you can edit, happens to be the primary key of the claims/claimDetails tables. So the form submits data to the database that the datagrid reads from; hence needing to refresh that table. So I would assume the second example you showed is the one to follow?
Nathan Lindley
|
|
|
|
|
Actually, the best example to follow in this case would be the first one. After the details are edited in the second form, the original form has to refresh its dataset so it can display the new data. The second form doesn't need to stay up if it's not editing anything.
What I meant by "running two forms simulataneously" is that the user can switch back and forth between the forms at any time, or they are modeless. A modal form is a dialog box. You can't continue with the rest of the application unless that dialog box is dismissed (OK or Cancel).
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How to make a WebBrowser go through a proxy server?
I think you can do it by changing the proxy-settings in Internet Explorer, but can you do it without doing that?
Greetings - mik
|
|
|
|
|
No, the WebBrowser class will only use the proxy settings setup in Internet Explorer.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Okay - how to set the proxy-settings in Internet Explorer then
And is it possible to use another control (like a downloaded) almost like WebBrowser with the ability of using proxy?
Thanks
|
|
|
|
|
I don't know of any 3rd party controls for this.
The WebProxy class in the .NET Framework 2.0 will NOT modify the system proxy settings. It will return a COPY of them though, which you can then modify for use in your own app. Don't get any cute ideas. The WebProxy class does NOT work with the WebBrowser class. It will only work with classes that are derived from the WebRequestclass, like HttpRequest.
You can either modify Internet Explorers proxy settings through the WinHttp API function WinHttpSetDefaultProxyConfiguration[^]. I do NOT recommend doing this, since it changes the proxy settings system wide!! ANY browser window that is open will have these new settings applied to it!!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|