|
Hi all,
I have a VB.NET assembly which calls into a COM object, the function being called returns a VARIANT, some of which are BSTR's allocated with SysAllocString() (Allocated within the COM object and returned to the VB.NET code).
The problem is that these BSTR VARIANT's are leaked as .NET does not know what to do about them.
Has anyone come across this, or does anyone know how to get the VB.NET code to clean up the VARIANTS ?
regards,
|
|
|
|
|
im kinda new to vb.net and was wondering how to call subs from other classes
example
dim MyClass as new MyClass<br />
MyClass.SendData("hello")
if I try to run this block of code in a new class I get a
nullreference exception error
if I use my database class and try to put the datareader info into my listbox on my main form it doesent work. any info would be of great help
thanks
|
|
|
|
|
I don't see anything wrong in the code... probably something wrong in the sub SendData.
Just as a good practice, you can give a different name for the object. (YOu have used the same name for your class and object)
dim myObject as new MyClass
----------------------------------------------------------------------
T Manjaly
My C# Tutorials articles www.dotnetspider.com
|
|
|
|
|
Also do I have to use parent/child forms or can i just close/show them?
here is the block of code im calling
<br />
Public Sub SendData(ByVal data As String)<br />
Dim writer As New IO.StreamWriter(client.GetStream)<br />
writer.Write(data & vbCr)<br />
writer.Flush()<br />
End Sub<br />
here is another block of code that wont work i have to be doing something wrong, first part of code is in a class called database in a sub called LoadPlayerCurrentLoc2
<br />
Dim Form1 As New frmMain<br />
Form1.UpdateStatus(myreader.GetString(0) & ": " & sender.Name)<br />
when I copy and past this block and run it from within the form it works great but from this class it dont work
my UpdataStatus code is as followed
<br />
Public Sub UpdateStatus(ByVal statusMessage As String)<br />
lstStatus.Items.Add(statusMessage)<br />
any ideas?
thanks
|
|
|
|
|
I can't figure out much from this.. probably the object 'client' is null leading to the null reference exception.
In the second case, that is that you are trying to do ? You want to update the status bar of the form? You can do this from the form which includes the status bar, but if you want to do this from a class, you may want to pass the reference of the parent form which includes the status bar.
----------------------------------------------------------------------
T Manjaly
My C# Tutorials articles www.dotnetspider.com
|
|
|
|
|
the updatestatus sub is just something I put in to place a string into a list box
like in my database sub i call the updatestatus from my main form called frmMain to check to make sure my oledbdatareader is pulling the right info and sending it to the client, this is more of a check system for me during creation, anytime there is a value that comes out of a sub I like to see it, to make sure the code is working right,
I also tried to inherit frmmain in my database class and this dident work, Im so lost atm...
|
|
|
|
|
Dear Friends,
I want to print my invoice on half of A4 size paper. Please can anybody help me how to make paper setupt for half of A4 size paper means 5.5" hieght. I checked the paper setp option in Crystal Rpeort but i did'nt find any paper size with 5.5" hieght.
your quick response will be highly appriciated.
Thanks
Murtuza
|
|
|
|
|
hi,
You have Two Methods
METHOD I
If you need to change the size or orientation of a Crystal Report, you can do this in the VS IDE by right-clicking your report and navigating Designer >> Printer Setup. On the first tab, you can choose the paper size and orientation. Hit OK to return to the IDE, and the report canvas will automatically resize to what you just specified.
I don't recommend setting any of the advanced printer options in your report unless you know the people printing the report will be using the same printer (such as a network printer). Also, if you can't fit your report on letter (or A4 for the metric world), the user is probably going to have to change the paper in the printer, which will more than likely cause some grumbling.
METHOD II
You can also change the bottom Margin of the paper to your custom size that is for half the page(5.5")
you can do this in the VS IDE by right-clicking your report and navigating Designer >> Page Setup. Modify the margins.
HAPPY PROGRAMMING !
With Regards,
Barathan.K
barathank@gmail.com
|
|
|
|
|
Hi murtuza,
I think Method II Works Great!!. You want to set the Bottom Margin to 5.5" and rest as by default.
HAPPY PROGRAMMING !
With Regards,
Barathan.K
barathank@gmail.com
|
|
|
|
|
Hi
I have a little question. I want with vb access to the aspi driver. Can i do it directly. I mean only with vb source without an another dll.
txh for help and sorry for the bad english
|
|
|
|
|
I have a big problem. I want to do my A-level and now I have to create a big presentation. My teacher had the idea for a topic: AI - artificial intelligence. But it's very difficult to find a structur for this subject and to include VB in my website I have to design.
In the internet I only can find definitions and those are very difficult to understand.
I need an idea urgently!!! How can I present AI in the right way, with examples (programming with VB) and in a way, that unkwowing people can understand????
Has someone a good idea????
thx
|
|
|
|
|
murmel wrote:
My teacher had the idea for a topic: AI - artificial intelligence
This is a big subject area. Why not pick a small area and do that rather than do a presentation on all of it.
murmel wrote:
But it's very difficult to find a structur for this subject and to include VB in my website I have to design.
Why must the website include VB? It isn't the best language with regards to AI.
When I was in high school (about 14 years ago now) we built a simple Expert System[^] (a kind of AI) using prolog. (See the link for more details about expert systems)
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hi All,
When i use the File.Copy (in an aspx page)to copy files between 2 computers(that has shared folders).(these copmuters can be different from the web server from which i call my page)
Example:-
File.Copy(Path.GetFullPath("\\servername\sharedfolder\test.bmp"), Path.GetFullPath("\\servername\sharedfolder\test1.bmp"))
the following exception occurrs:-
System.IO.FileNotFoundException: Could not find file "\\servername\sharedfolder\test.bmp"
the folder is shared with full permissions...
i don't know what is the problem???
Any comment will be very helpful..
thanx
netSam
|
|
|
|
|
netSam wrote:
the folder is shared with full permissions...
The folder is shared with full permissions to what account? Are your machines in a domain environment or workgroup?
Your web app runs on the server under, by default, the account ASPNET. This account normally doesn't have permissions to much else on the server, let alone other machines.
If you're running in a domain, then the account can be created in the domain and other machine in the domain will trust the account. All you have to do is give it permissions to the share/folder you want on the machine you want.
If your're running in workgroup, then each machine has it's own list of accounts and will not trust the accounts of another machine. In this case, you'll either have to give permissions to the Everyone or NETWORK group on the machine that is sharing out the files you want, or...
Create an account on the machine that is sharing out the files you want, give this account appropriate permissions to the share/folder, then rewrite your code to use this "machineName\Account" when it needs to login to the sharing machine and get at those files.
Also (almost forgot!), the ASPNET account on the server must also have appropriate permissions on the server where your copying these files to!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
my machine is in a domain environment and the folder is shared with full permissions..
when i try to copy from local drive to this shared folder, the copy done successfully...so i can not undersatand why it can not read the file on thisfolder to copy from!!!!
|
|
|
|
|
Full permission to who? If you are logged in and copy a file it will be copied with your personal set of permissions. If you copy it within a webpage on the webserver you will copy it with the permissions set for the server. This is (as already mentioned) by default the user APSNET. So make sure that this user has the needed permissions to copy the file or configure the webserver to run under a different account.
I would prefer the first alternative.
|
|
|
|
|
Hi Dave and Robert
As u both said, i checked my sharing permission..and i was giving the logged client user the full permission not the APSNET user..
i add in the security tab the everyone user with at least the read permission and now i can copy the file..
thanx for your replies..
I will rate both of your msgs 5
Shall i do anything else???
thanx
netSam
|
|
|
|
|
Well...
send some money?
The best you can do is to read this forum regulary and try to help others.
|
|
|
|
|
I will try to do
thanx again for your help...
|
|
|
|
|
Hi,
Suppose that I have 10 string values that required to be used globally within my project. I learned that I have two ways to archive this one is by declare those 10 variables as public const, another one is to use only one public collection.
what are the nuts and bolts between these two? which one is better than the other one?
Thank for your help.
Good bye,
|
|
|
|
|
|
i just responded to someone with a question much like this over in the asp.net forum. Here is a link:
Here[^]
Assuming that your 10 strings are related in some way, you could create an object to hold those values as properties. This would give you a single place to make changes in the future if something were needed to be changed for these variables, vs searching your entire project for the var name.
Not sure if your looking for a web solution or not, but either way, the object idea would work in your case no matter the type of application.
btw, I am not a fan of the 10 public constants at all.
Levi Rosol
Blog By Levi[^]
|
|
|
|
|
Hi Ppl,
I would like to know if it is possibe to restrict (Key in) the number of charcters in a col for the DBgrid.
Like in MSFlexgrid I could restrict the length of the textMatrix in the Keypress event.
Is this possible in the DBGrid.
Tnx
|
|
|
|
|
I am creating several instances of a form. The problem is that I would like to update a few things before the form is shown. It seems that any reference to the new form causes the Form_Initialize and Form_Load functions to get called. Any ideas? PostIt is the form in question...
[code]
Private piPostIt() As New PostIt
While rcsMemo.EOF <> True
iIndex = iIndex + 1
ReDim Preserve piPostIt(iIndex)
Set piPostIt(iIndex) = New PostIt
If rcsMemo.Fields("Graphic Note").Value = True Then
piPostIt(iIndex).chkGraphic.Value = 1
Else
piPostIt(iIndex).chkGraphic.Value = 0
End If
If piPostIt(iIndex).chkGraphic.Value = 1 Then
piPostIt(iIndex).pbPostIt.Picture = LoadPicture(rcsMemo.Fields("Memo BMP").Value)
Else
piPostIt(iIndex).tbPostIt = rcsMemo.Fields("Memo Text").Value
End If
piPostIt(iIndex).Top = rcsMemo.Fields("StartupTop").Value
piPostIt(iIndex).Left = rcsMemo.Fields("StartupLeft").Value
piPostIt(iIndex).Height = rcsMemo.Fields("StartupHeight").Value
piPostIt(iIndex).Width = rcsMemo.Fields("StartupWidth").Value
piPostIt(iNumPostIts).Show
rcsMemo.MoveNext
Wend
dbPostIt.Close
[/code]
Thanks,
Tim
|
|
|
|
|
Make the things you want to modify into public properties, set these properties after you have initilized the instance of the form (i.e. after you have called the constructor):
Dim newForm As New MyForm 'Initilize will be called here
newForm.MyProperty = "Something"
newForm.Show
Hope this helps
Tom
|
|
|
|