|
Did you look at Delegate.CreateDelegate() ?
I've never used it, but it seems close to what you need.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Yes...
Dim sNewCallbackQuery as string = "new('System.Threading.TimerCallback',null,addressof(opt,'Loop'))"
Dim snewThrTimerQuery as string = "new('System.Threading.Timer'," & sNewCallbackQuery & ",null,0,100)"
Dim optionalObj as object = me
StringToCode.query(snewThrTimerQuery,optionalObj).getresult()
when the StringToCode parses this part : "addressof(opt,'Loop')"....
it uses the [Delegate].CreateDelegate to create the delegate of the 'loop' method of main form....
and i have to use this delegate to create the TimerCallback Object....
im stuck in this part!!
if i manage to create the System.Threading.TimerCallBack object....
then i can create the System.Threading.Timer object with the callback as a paramater....
and the loop method will be called every 100 milisecs
|
|
|
|
|
Hi,
I have developed a small application for Windows Mobile 6.x OS with VB.net and When I browsethe available .NET references, The Microsoft office com objects are not listed. My aim is to convert a listview to an Excel file in mobile application. Therefore I intended to define "Imports Microsoft.Office.Excel" statement but there is no office com objects. How can solve the problem
Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Do you have office or the visual studio tools for office installed?
|
|
|
|
|
You are a bit stuck I'm afraid. Referencing the Excel Automation objects will not work for you because it is not Excel you are interfacing with, but rather Pocket Excel. Problem is that Pocket Excel does not expose and automation interface, therefore you cannot do it.
I have heard that there are third party products that enable you to work on the underlying files directly. www.tmssoftware.com[^] provides some of these, though I have never tried to use them.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hello!
I am wondering how i send console commands like:
give weapons_Whatever
or
Sv_chats 1
to counter-strike: source with my vb.net application.
I am thinking of my app as a Trainer . . . .
I dont whant it to send keystrokes I whant it to send actual commands . . .
|
|
|
|
|
You would have to hook the actual application if you didn't want to send keystrokes.
|
|
|
|
|
None is going to help you cheat.
|
|
|
|
|
At least he's cheating at a game and not homework.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
After playing Modern Warfare 2 (IMHO, the Game of the Century!) on XBL, I don't care if he's cheating at TicTacToe. It still pisses me off that someone would rather cheat than improve their own skills at the game!
|
|
|
|
|
Sorry for what must be a very basic question, but here goes:
My main project is getting too big, so I want to move some of my classes to a class library
Once I do that, however, the classes can no longer find the classes in my main project
What's the solution?
I can see that it could be possible to reference the main .exe from the .dll but doing so seems odd to me because the main .exe also references the .dll.
Thanks
|
|
|
|
|
Referencing both ways can be done, but not in one solution. However this would just indicate your design is wrong. Classes in your class library should be used by the main app classes and not reference them. If you have to reference them then either move more classes to the class library or move them back into the main app.
As to getting too big, we have projects containing hundreds of classes, which is fine when they are organised in a decent folder structure. I have heard of projects that extend to thousands of classes and take up to an hour to build without problems.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Create a class Library... Produce a Dll and then Reference it.
This might be the simplest. But do you think all the units by this way may have produced a unseparable block.
The main motive of making external class libraries and compile as dll is to create independent module.
I recommend you to refactor each classes to produce independent modules and then reference it. I think the compiler is intellegent enough to load the dll when required.
I wrote a fine article to demonstrate how dependency between modules might kill your performance. Check it out.
Simplify Code Using NDepend[^]
So as suggested, To separate classes is not what you are making. If you just want to separate classes, make a folder place them.. and you might call them using a namespace. But if separation is really required, you need to find out classes that are actually independent of other modules(Such as utility classes).
Hope you understand.
Cheers..
|
|
|
|
|
A small correction, assemblies are loaded by the Runtime, not by the compilers.
|
|
|
|
|
Thanks for your comments...
This is not an organizational problem but a performance one. I figured my program would load faster if some of the classes were in a separate dll. But perhaps that is not true (didn't test it yet)
|
|
|
|
|
I am trying to control and run a MAtlab program through VB code. Please help me in writing the code.
csetopper_bhanu
|
|
|
|
|
csetopper_bhanu wrote: I am trying to control and run a MAtlab program through VB code. Please help me in writing the code.
Try this[^].
|
|
|
|
|
I'm writing a program to print certain webpages. The user must click a command button and the program will gather the urls (not relevant to the problem) and then navigate a hidden WebBrowser control to each URL and calls the Print method. No errors appear and everything seems to be working fine. Even when stepping through each line there is nothing to suggest that it didn't print. However when I walk to my printer there is not a single paper there. I made the window bigger and made the WebBrowser control visible and I can verify that it is properly navigating to each URL. Thinking that the problem may be with the speed of which the URLs are being visited, I created a test form.
This code appears in the loadform:
WebBrowser1.Navigate("http://www.google.com")
This line is inside a command button:
WebBrowser1.Print()
The command button is pressed when the page is 100% loaded and it still does not print. I've tried to use ExecWB but Visual Studio does not seem to recognize the method. The same problem exists when trying to use the ShowPrintDialog() method. Any help would be much appreciated!
|
|
|
|
|
Try to uninstall your printer driver and install it again .
|
|
|
|
|
Make the browser control visible and try it again.
|
|
|
|
|
I need someone to help me figure out what I am doing wrong in the following code. It is supposed to multiply the number of items ordered times the price (3 pizza slices, 4 french fries and 5 sodas). The program is then supposed to total the price of all the items up in a listbox. I also need to know where to insert the additional coding required.
Private Sub btnComputeCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnComputeCost.Click
Dim num As Integer
Dim duration = "", item = ""
Dim cost As Double
Dim fmtStr As String = "{0, -29}{1,-7:C}{2,-20}"
ListBox1.Items.Clear()
num = CInt(mtxtItemNum.Text)
num = mtxtItem2Num.Text
num = mtxtItem3Num.Text
Select Case num
Case 1
item = "Pizza slices"
cost = 1.75
Case 2
item = "Fries"
cost = 2
Case 3
item = "Soft drinks"
cost = 1.25
Case Else
item = ""
MessageBox.Show("Not a valid item.")
End Select
If (item <> "") Then
ListBox1.Items.Clear()
ListBox1.Items.Add("Receipt from Restaurant")
ListBox1.Items.Add("")
ListBox1.Items.Add(String.Format(fmtStr, item, cost, duration))
ListBox1.Items.Add(String.Format(fmtStr, "Processing Fee", 5, ""))
ListBox1.Items.Add("")
ListBox1.Items.Add(String.Format(fmtStr, "Total", cost + 5, ""))
End If
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
|
|
|
|
Where do I start! The point of homework is to learn not to get others to do it for you. The code you have written so far won't even compile.
Scamperdoodle wrote: Dim duration = "", item = ""
Should say
Dim duration As String = String.Empty
Dim item As String = String.Empty
Scamperdoodle wrote: num = CInt(mtxtItemNum.Text)
num = mtxtItem2Num.Text
num = mtxtItem3Num.Text
You are picking up each value and overwriting what you had before. Should go into three variables not one.
Why output to a list box when a Label or a textbox would be more appropriate?
Handling click events on labels makes no sense.
So, start from the beginning and think logically. Gather the input, do the maths and then create the output. It's not that difficult.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
I'd fail you purely on bad naming convension of labels, textboxes and variables.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I am trying to convert this C# code to vb and am having some trouble, it is from a WCF project located here http://www.codeproject.com/KB/webservices/wcftransfer.aspx?msg=3269789
I did try a online C# to VB translator but what it spit out as code the VS IDE didn't like
Here is the piece of code:
ThreadStart start = delegate
{
form = new TProgress(null, port);
form.sport = sport;
form.Show();
form.GetThread = new Thread(new ParameterizedThreadStart(form.GetInvoke));
form.GetThread.Start(transfer);
};
HelpClass.Form.BeginInvoke(start);
this is as far as I have gotten
'Dim start As New ThreadStart(AddressOf ) <--Not sure what this delegate is, AddressOf "what"?
Dim form As New TProgress(DBNull.Value, port)
form.sport = sport
form.Show()
form.GetThread = New Thread(New ParameterizedThreadStart(AddressOf form.GetInvoke))
form.GetThread.Start(Transfer)
'HelpClass.Form.BeginInvoke(start)
Thanks in advance...
Worked on my Machine!
|
|
|
|
|
Easy, put your VB code in a seperate method than create the ThreadStart using that method.
Private Sub SomeMethodName()
Dim form As New TProgress(DBNull.Value, port)
form.sport = sport
form.Show()
form.GetThread = New Thread(New ParameterizedThreadStart(AddressOf form.GetInvoke))
form.GetThread.Start(Transfer)
End Sub
And for the line you couldn't convert:
Dim start As New ThreadStart(AddressOf SomeMethodName)
Now, I'm not saying this code is going to work. Also, if this is doing what I think it's doing, it's a REALLY bad idea to create and show a form from a thread that is not the UI thread (the one your app started on).
|
|
|
|