|
Ignoring the project type does your IDE have the same layout/windows as Figure 3 here?
If you look at the bottom right-hand corner that's where you'll see it.
Sorry I can't find a better example on msdn site, they've taken dowm a lot of the WinCE VB stuff, but using VS2008 doesn't help either. I don't have VS2008 installed right now, but I'll try and sort something out so that I can see what/where the problem lies.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
Hi all.
I have an interesting problem (Interesting to me, anyway ).
I have a form loading, and in the process, an RTB is being loaded with a really super long RTF string. In the process, I get the ContextSwitchDeadlock message box. Now, from what I can gather, it seems to be telling me that system requests have not been able to be carried out for at least 60 seconds while the string is being loaded, and the message is telling me that you can't expect to be able to do anything else while that is going on, AND there may be an evergrowing queue of system tasks that have been put off until the string finishes loading. If this is true, I imagine I am getting the message because this is not a case where DoEvents() would be of any help...As the RTB is being loaded with the string, all of that activity is not code that a DoEvents() line can be inserted into.
So I started looking around, and discovered talk about message pumps (message loops), but no great information on them in general. So my question is, is a message pump what I need, and if so, how do I implement such a thing?
Thanks for any guidance!
|
|
|
|
|
Your app already has a message pump. It always runs on the UI thread (startup thread) and it's the little bugger that triggers that message "Not responding" when your code blocks the UI thread and the message pump can't be processed because of it.
The message you're getting is because COM interop happens through the message pump. You app is using a COM-based component (whether you know it or not) and COM message are not being processed because the message pump is prevented from running by your extremely long running operating (the RTF load).
Adding a second message pump isn't going to accompish anything because it also will be blocked.
The good news is that message only appears when running the code under the debugger. Even better, you can disable it in your app.config. See this[^].
THe better solution would be to NOT load such a massive document into the RTB.
|
|
|
|
|
AAAhhh...OK. Got it. And I can breath a sigh of relief since I am sooooo close to doing a final build and MSI.
I suppose I could break the RTF string up into pages and let new pages load when the scrollbar brings those portions into view.
|
|
|
|
|
Is there any way to create a Global HotKey in vb.net that is shared across all the forms in a project, not just one form that is registered to?
|
|
|
|
|
Possible??? Yes.
A good idea?? Not so much, depending on what you want to happen if you have multiple forms running at the same time.
If you want each form to process the hotkey, you'll have to implement things a bit differently than if you wanted only one action to happen not matter which and how many forms are open.
So, which is it??
|
|
|
|
|
I was trying add current date to a textbox in the current control when a user press something like Alt+D. I used an example from this Article: Setting A Global Hot Key I modified the code to something like this:
Protected Overrides Sub WndProc(ByRef msg As System.Windows.Forms.Message)
Select Case msg.Msg
Case ForcHotKey.WM_HOTKEY
If CShort(msg.WParam) = m_HotkeyID Then
If TypeOf (Me.ActiveForm.ActiveControl) Is TextBox Then
Me.ActiveForm.ActiveControl.Text = Me.ActiveForm.ActiveControl.Text.Insert(Me.ActiveForm.ActiveControl.Text.Length, DateTime.Now.ToShortDateString)
Dim tb As TextBox
tb = Me.ActiveForm.ActiveControl
tb.Select(Me.ActiveForm.ActiveControl.Text.Length, 0)
End If
End If
Exit Select
Case Else
MyBase.WndProc(msg)
Exit Select
End Select
End Sub
All I have to do is to register the hotkey in the main MDI Form. No matter which form I'm at, while typing in the textbox whenever I press hotkey I get the current date.
|
|
|
|
|
Well, I guess that answers the question of exactly what you were trying to.
Glad you got it working.
|
|
|
|
|
I have a form that starts with nothing on it.
I am adding controls to the form dynamically at run time.
This is the class declaration for the form.
Public Class foo
Public Sub New()
InitializeComponent()
End Sub
End Class
So here is my question - how do I force the developer to always create a new instance of the form rather than allowing them to refer to it without the new keyword?
I need to do this as I pick up old instances when I refer back to the form.
At present the developer needs to code.
fooHelp.filterForm(New foo,...)
If the developer codes the following, issues are hit later when old instances are pulled back.
fooHelp.filterForm(foo,...)
How do I ensure that when the developer codes fooHelp.filterForm(foo,...) they get an error message?
I feel like I was hit by the silly stick over the weekend and have had not had any luck with google(probably because I don't know how to phrase my question due to the silly stick...).
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
|
Thanks Eddy - I thought I had not hit this issue before in C# which is what you explain.
I may just need to find some way of coding around this - I can just see someone forgetting to use the new keyword, as I did this morning, and causing chaos...
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Just created a vb-project, thrown in a second blanc Form and called it from a button's click using the ugly "Form2.Show"-approach. Using ILSpy, it's visible what's being generated;
internal sealed class MyForms
{
public Form1 m_Form1;
public Form2 m_Form2;
public Form2 Form2
{
[DebuggerNonUserCode]
get
{
this.m_Form2 = MyProject.MyForms.Create__Instance__<Form2>(this.m_Form2);
return this.m_Form2;
}
[DebuggerNonUserCode]
set
{
bool flag = value == this.m_Form2;
if (!flag)
{
flag = (value != null);
if (flag)
{
throw new ArgumentException("Property can only be set to Nothing");
}
this.Dispose__Instance__<Form2>(ref this.m_Form2);
}
}
} It's sealed, and generated by the compiler. It's only "illegal" if you change the project type from "Windows Forms Application" to "Console Application". Alternatively, one could consider the factory-pattern for forms;
Public Class Form2
<Obsolete("Use the CreateNew method")>
Sub New()
Throw New ApplicationException("")
End Sub
Private Sub New(ByVal skip As Boolean)
InitializeComponent()
End Sub
Public Shared Function CreateNew() As Form2
Return New Form2(True)
End Function
End Class The generated code will try to use the parameterless version of the constructor, and throw an ApplicationException . Not a very good alternative.
I think this would be better solved by writing an FxCop-rule.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The factory pattern looks like an alternative that should be straightforward to implement.
This is the first time I have hit something in VB which has worked against me.
Thanks for all of this - it's been something of an education coming up against this issue.
Thanks for all your help!
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
You're welcome
|
|
|
|
|
I think you are describing the default instances of the project's forms that are created when the "application framework" is enabled (if this is not the case, please ignore the rest of this). Enabled is the default case when using the "Windows Forms Application" template to create a new project.
To avoid these default instances, create your project using the "Empty Project" template. When starting with "Empty Project", you will not initially have the "My" namespace available, but it will be created for you if you go to Project Properties->Settings and click on "This project does not have a default settings file. Click here to create one.". This will reclaim My.Settings for you but nothing else, but most of that stuff is just icing anyways. If you feel the need, you could always add them back into the "My" namespace.
For more info on recreating the My.Stuff, see: How to: Use the My Namespace (C# Programming Guide)
|
|
|
|
|
I have created a setup of my project and in the custom actions I am running two .EXE file. One for key generation and the other for deleting the Key generation executable. The problem which happens because of the deletion of this key generation file is that the shortcut created then tries to reload the setup since there has been change in the startup folder. I have tried to make the two executable VITAL = "FALSE". Still it does not work.
I am using VB 2008 Setup and Deployment option
Need help in solving either of the two issues:
1. Is there any way I can run an executable without getting it copied into the startup folder?
2. If no, then how to make the shortcut refer to the main executable file even after the file is deleted from the startup folder?
|
|
|
|
|
I am facing a very typical problem. Let me try to define the issue
I have a label which has a text value as $789.75. When I transfer this value to a String variable the value becomes $789.75. Now if I have VB 2008 installed in the machine and when I run the program I can transfer this label text into a Double variable and after transfer the value of the DOUBLE variable becomes 789.75. How This happens I am not aware. This works even if I have installed VB some time and have now un-installed it. But if I make a setup file and install in a machine which does not have VB installed then it gives error "Not able to convert String to Double".
I hope I am able to clearly state my problem.
Can anybody tell me which .NET or .COM file is helping in this conversion from string to double without the $ sign. This will help me in adding that file when I am creating the setup.
|
|
|
|
|
You do not explain how you are converting the value, but the Double::TryParse Method[^] is the best way.
Use the best guess
|
|
|
|
|
Richard, Thanks for the suggestion. What i am using is CType method. As far as Double.Tryparse method is concerned, I find according to MSDN it does not work on strings which contain $ sign. Double.Tryparse can take care of <,> and exponents. My issue is as told before, if VB .net is installed in the machine then CTYPE(string, Double) returns only the number 757.49 where string = $757.49. But when VB .net is not installed same command throws an error "Cannot convert String to Double".
|
|
|
|
|
According to the documentation[^] this is compiled inline so it should work on any system, as long as you have the correct version of .NET installed. Sorry, but I cannot suggest anything more that would help.
Use the best guess
|
|
|
|
|
Thanks Richard. I really appreciate taking some time out and trying to solve my problems. I am also not sure why this is working in one machine and not in another. As far as .Net is concerned I have .net Framework 4 installed in both the machines. I will try out some more combinations.
Thanks again.
|
|
|
|
|
Have you compared the regional settings of the various machines? At a guess I would say that the development environment is using English(United States) or some other culture that has $ for the currency symbol. All the 'helpful' stuff built into the VB conversion routines is probably ignoring the default currency symbol.
|
|
|
|
|
Yes Alan, You are right. Regional Setting issue was causing the problem.
Thanks for the suggestions.
|
|
|
|
|
_ hooray! need help for my project .. I am developing a Payroll System .. I have a Stored Procedure created using SSMS 2005 ..details:
Stored Procedure Name: Find_Emp
Command/Query=
SELECT * FROM EMP0000 INNER JOIN EMP0001 ON EMP0001.EMP_NO =EMP0000.EMP_NO WHERE EMP0000.EMP_NO=@empno
In my GUI using Visual Studio 2010, I have a ListView where the list of employee listed..
I want to call the procedure in SelectedIndexChanged Event of the ListView ..
My problem is don't have an idea how to call this procedure in visual studio 2010 .. any help please ?
|
|
|
|
|
alecxa05 wrote: don't have an idea how to call this procedure in visual studio 2010 The same way you would call it in any version of Visual Studio. Add an event handler for SelectedIndexChanged and put your SQL command in there. See these links[^] for samples and suggestions.
Use the best guess
|
|
|
|