|
Is something wrong or is this OK. If I add two variables with a data type of single and like (845.12 + 312.14) and sent this directly to a text property of a label the display shows 1157.26. But if I store the sum into a variable with a data type of Double then display, it shows
1157.26000976563. Am I not allowed to convert a single to a double?
|
|
|
|
|
You are allowed to do this, but because of representation differences, you'll get results like these. The best way to do this is to use consistant data types. If the results of your calculations are requiring doubles, then use doubles for all the operands involved, not singles.
This is directly from the VS.NET 2003 documentation:
A conversion from a value type stores a copy of the source value in the destination of the conversion. However, this copy is not an exact image of the source value. The destination data type stores values differently, and even the value being represented might change, depending on the kind of conversion being performed.
RageInTheMachine9532
|
|
|
|
|
The problem is that I am pulling data from Microsoft Access. No matter what data type I use in Access I can only place that data in a Single data type within VB.
I used a little cheatiing by multiplying the return value by 100 and then transfering to a double and then deviding by 100.
This if fine if the data in Access is currency but other data would just have to only be transfered to a VB single data type.
|
|
|
|
|
I am developing a client/server application using VB.NET in VS.NET 2002. The client application have a form (Form A) that query the server application via Winsock and once Form A received the server's response (DataIn event) it launch Form B and hide Form A. The problem that I am having is that Form B is not responsive after it's launched. What is the problem? Please help?
I tried launching Form B using a button in Form A and it works perfectly. But Form B is not responsive when it's launched to in the DataIn event, it's not responsive at all. Please help.
|
|
|
|
|
The DataIn event is probably firing on another thread than the UI thread (ie Asynchronous processing). You must using the Invoke method of the form (or indeed any control on the form) to execute the code on the UI thread.
Look at the Control.Invoke method is VS Help.
|
|
|
|
|
Me.Invoke(New MethodInvoker(New <functionname>)) worked. Thanks..
|
|
|
|
|
I am trying to print a label to an older dot matrix printer. I want to be able to print one or two labels and then not feed any more labels through the printer. I have tried changing the pagesize in the documents pagesettings with no noticable results. The printer still feeds the entire page. Anyway any help or suggestions would be appreciated. Thanks
|
|
|
|
|
I've never done it (because I haven't had any reason to use a dot matrix printer in about 10 years!), but you'll probably need to send RAW data to the printer, bypassing the printing classes in the .NET FCL. You could TRY mapping LPT1: to your printer and sending the data out the LPT port using a Stream. I don't have any example code...
RageInTheMachine9532
|
|
|
|
|
I have created a registry search program, but it speed is crawling. It takes about 100 seconds to pass throught CLSID, Interface and Typelib keys. I wonder if i could speed up the search (by loading the whole keys into memory for example). I use VB6 with standart registry manipulation APIs: (RegOpenKey,RegEnumKey,RegEnumValue).
Only Absolute Power and Absolutely No power matters. The rest is slavery.
|
|
|
|
|
There's no way to load it in memory first. You might want to look at your code, very closely, for optimization opportunities. Since you didn't supply any code sample, it's really hard to tell you what you might try to get an advantage.
RageInTheMachine9532
|
|
|
|
|
Hi,
I want to know how I can retrieve the 'onchange'-Event of an HTML-Input-Element in my vb.net-code? I have access to the documentproperty (DOM) of the Webbrowsercontrol.
Thx,
Dartrax
|
|
|
|
|
|
I'm using VB.NET 2003. I've written a program to read registry keys from remote computers. However, I must be logged in with my domain ID & password for this to work. If I log in locally (same ID & password as my domain credentials) I get "permission to the registry key is denied".
I've searched high & low for documentation and examples of how to authenticate to a remote pc, but so far have come up with nothing.
Also, we have 2 domains. I have the same ID & password on both domains. If i'm logged in on a PC in Domain1, I can only access Domain1 PC's. So I also need to access Domain2 PC's from a Domain1 PC.
Any help is appreciated.
|
|
|
|
|
tolsen64 wrote:
Also, we have 2 domains. I have the same ID & password on both domains. If i'm logged in on a PC in Domain1, I can only access Domain1 PC's. So I also need to access Domain2 PC's from a Domain1 PC.
You must use your Domain2 credentials. Using your Domain1 (or local) credentials will not get you access to any machine in Domain2. Your app can be launched using different credentials (Run As) using Explorer, but I'm not aware of any equivelent in the .NET FCL.
RageInTheMachine9532
|
|
|
|
|
I need some information on how to calculate year's difference between two date. And if there is such a function already existing in dotnet for that kind of operations. Thank you in advance.
I am a not so total newbie
|
|
|
|
|
For those with same problem, there is a method substract who can help you very much
I am really a newbie
|
|
|
|
|
This is for VB6... not sure about .net
Say your first date is 20/12/2000 and your second date is 15/12/2004
Dim strDate1 As String
Dim strDate2 As String
Dim strDifference As String
strDate1 = "20/12/2000"
strDate2 = "15/12/2004"
strDifference = DateDiff("yyyy", strDate1 , strDate2)
msgbox strDifference
'This will be 4 years
Dont know if that is what you were looking for??
Anyway...
Later
|
|
|
|
|
I have an application that works with Excel. I am trying to add an Excel text box to a spreadsheet programmatically. I have the code, but I get a syntax errort which says that I need a reference to the Interop assembly Microsoft.Office.Core. I already have this reference in my project. what is going on here? I tried removing then adding the reference to my project. I can find the assembly in the Object Browser, but my code can't!
Thanks!
|
|
|
|
|
Is there a way to set where the printer starts printing... IE I need a 1" margin from the top, and a 1" margin from the left
can anyone help, thanks
|
|
|
|
|
I have built a custom control which contains a bunch of TextBoxes and 5 Comboboxes. I set the tab indices so that the user can tab through the controls in the proper order. I also wrote event handlers for all the controls so that pressing the return key is equivalent to pressing the tab key.
My problem is that pressing the return key while one of the 5 ComboBoxes has focus doesn't work - nothing happens. You must also press the tab key twice to move through this ComboBox. I have tried deleting the problem ComboBox and replacing it with a copy of one that works, and have also checked the code in my event handlers, but to no avail.
does anyone have any idea what might be wrong?
Thanks!
|
|
|
|
|
I dont know what is the problem with you. But the following event handler works fine for both the TextBox and ComboBox. Try this.
private void EnterToTab(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == (char) 13)
{
SendKeys.Send("{tab}");
e.Handled = true;
}
}
|
|
|
|
|
Hi to all,
i have developed a Remote Desktop application.
The server in a Windows Service.
When i restart the PC, i send ctrl+alt+del from client, and then i must send the authntication data.
I'm not able to capture the login screen.
Can anyone suggest me a function to capture the login screen, or how i can log in my system by-passing the windows login window (not auto-login)
Thanks in advance
Davide Vitiello
|
|
|
|
|
Your app on the target machine is either going to have to run as a service, or your going to have to use the auto-login feature.
When you press C-A-D, all of your user processes are halted, for security reasons, so your app won't be able to do stuff like keylog the password. Services, on the other hand, stay running...
RageInTheMachine9532
|
|
|
|
|
hello to all
1. i have an mdi parent form.and there are some child forms. i want to restrict loading a child form to "only once". i don't want to allow loading a second instance of the same form (while the first instance is still exits) when the user choose to load the same form again.
i mean only one instance of any form at any point of time)
how can i restrict this ... shall i check each form in the MdiChildren array of the mdiparent or is there any other easy way ?
2. if more than one child form are loaded, i want to restrict the user moving through these forms. like if any transaction is in the middle state (not updated) in the present form and the user tries to go to the other form, then i want to cancel the present transaction and allow the user to go to the other form.
i have tried form_lostfocus and form_leave but these couldn't hlep me out ...
how i do this ?
any one please help me out.
thanx in adv.
Mohan G
|
|
|
|
|
Hi,
How can I start / stop a windows service from my vb application. can I get a sample
Shenthil
|
|
|
|