I would like to find out whether there is anyway to remember a directory path without hardcoding the path name to a variable. This will allow me to change the directory path easily without changing the code.How to remember the directory path with VB.net without hardcoding the path name to a variable?
if it helps, use GetCurrentDirectory() method in System.IO namespace. you can change the directory later in the code as you like. refer to sample in msdn.
Dim path As String = Directory.GetCurrentDirectory()
http://msdn.microsoft.com/en-us/library/鈥?/a>How to remember the directory path with VB.net without hardcoding the path name to a variable?
I presume you mean you want the directory to where your software is:
You want to reference the Application.StartupPath property. This will tell you where the launched the application from and then your application's directories remain dynamic. To refer to a subdirectory you could use something like:
Application.StartupPath %26amp; ';\bin';
There are a couple of really easy ways. One is to use SaveSetting and save the path name to the registry, and use GetSetting to retrieve it. The second way is to write it to a file.
Thursday, November 11, 2010
How to turn of DEP integration in VB applications?
I've made a web browser in Visual Basic and whenever I try to open up certain sites, Data Execution Protection closes my program... I've tried turning it off for that program under advanced system settings but it says that the program cannot have DEP turned off here.
Thanks a ton!How to turn of DEP integration in VB applications?
DEP is part of the operating system rather than a VB function.
The following page describes how certain applications can be excluded in XP
http://technet.microsoft.com/en-gb/libra鈥?/a>
This may be the page you are referring to.
A better course would be to try and understand why DEP is closing the program.
The following Microsoft articles give information about DEP and what causes an error:
http://msdn.microsoft.com/en-us/library/鈥?/a>
http://technet.microsoft.com/en-us/libra鈥?/a>
Perhaps download the page using something like FlashGet. that allows you to download individual components like Javascript.
If you do exclude it from DEP then you need to make it a short term measure until you can resolve the problem. As a fellow developer I wouldn't want to use a browser that was corrupting memory which seems to be what DEP protects you from.
Thanks a ton!How to turn of DEP integration in VB applications?
DEP is part of the operating system rather than a VB function.
The following page describes how certain applications can be excluded in XP
http://technet.microsoft.com/en-gb/libra鈥?/a>
This may be the page you are referring to.
A better course would be to try and understand why DEP is closing the program.
The following Microsoft articles give information about DEP and what causes an error:
http://msdn.microsoft.com/en-us/library/鈥?/a>
http://technet.microsoft.com/en-us/libra鈥?/a>
Perhaps download the page using something like FlashGet. that allows you to download individual components like Javascript.
If you do exclude it from DEP then you need to make it a short term measure until you can resolve the problem. As a fellow developer I wouldn't want to use a browser that was corrupting memory which seems to be what DEP protects you from.
How to link visual studio or vb with java programming?
Is it possible to link visual studio with java? I mean, i'm planning to develop the interface of a software using visual studio while the coding will be using java programming? is it possible? how to link it?How to link visual studio or vb with java programming?
You may find this website with some useful suggestions for the Microsoft .NET and Java/J2EE Interoperability
http://msdn.microsoft.com/en-us/vstudio/鈥?/a>
In the past, where I had worked with JAVA and .NET - the JAVA code was a Service Oriented Architecture (SOA) and the services were called by the C# code.
You'll find that C# and JAVA are very similar - different libraries, but syntax similarity is pretty high. Switching back and forth is not difficult. If you want to know more about that practice, then don't hesitate to send me an email (irishtek@yahoo.com)How to link visual studio or vb with java programming?
they two are entirely different.
VS works with MS Excel and uses VBA
JAVA uses JDK and JRE and is object oriented.
I dont think so.
If you could somehow manage to create the ';interface'; as a COM ActiveX Server object, you may use Java-COM bridge available on the net freely, like JCom (http://sourceforge.net/projects/jcom/), JACOB (http://sourceforge.net/projects/jacob-project/) or several other implementations.
You may find this website with some useful suggestions for the Microsoft .NET and Java/J2EE Interoperability
http://msdn.microsoft.com/en-us/vstudio/鈥?/a>
In the past, where I had worked with JAVA and .NET - the JAVA code was a Service Oriented Architecture (SOA) and the services were called by the C# code.
You'll find that C# and JAVA are very similar - different libraries, but syntax similarity is pretty high. Switching back and forth is not difficult. If you want to know more about that practice, then don't hesitate to send me an email (irishtek@yahoo.com)How to link visual studio or vb with java programming?
they two are entirely different.
VS works with MS Excel and uses VBA
JAVA uses JDK and JRE and is object oriented.
I dont think so.
If you could somehow manage to create the ';interface'; as a COM ActiveX Server object, you may use Java-COM bridge available on the net freely, like JCom (http://sourceforge.net/projects/jcom/), JACOB (http://sourceforge.net/projects/jacob-project/) or several other implementations.
How can i access a bluetooth device using dot net Framework with a vb program or C# program?
I am creating a program to control PC using mobile through bluetooth. For this i need to access the bluetooth using a program. I am developing this program using dot net framework. I have chosen the VB language. Can any one please explain how to access the bluetooth device using .net framework? Thanks in advance.......How can i access a bluetooth device using dot net Framework with a vb program or C# program?
Have a look at this code sample:
http://www.java2s.com/Tutorial/CSharp/05鈥?/a>
This may also be useful:
http://software.informer.com/getfree-sou鈥?/a>
Have a look at this code sample:
http://www.java2s.com/Tutorial/CSharp/05鈥?/a>
This may also be useful:
http://software.informer.com/getfree-sou鈥?/a>
Thursday, October 28, 2010
How to make a program to derive and integrate functions in VB?
I need a program to derive and integrate functions and to solve second order differential equations.How to make a program to derive and integrate functions in VB?
I don't understand what you are asking? You say you need to make a program in VB to do it. But then you say you need a program? Which is it?
If you are asking this question, odds are you are nowhere near skilled enough to parse equations, let alone integrate them. So I'll just assume you need help doing these math functions, so here is some software that can do it for you.
A program called Sage.
http://www.sagemath.org/download-windows鈥?/a>
However, I personally use Derive 5, but I don't think they sell it anymore.ovarian cyst cause
I don't understand what you are asking? You say you need to make a program in VB to do it. But then you say you need a program? Which is it?
If you are asking this question, odds are you are nowhere near skilled enough to parse equations, let alone integrate them. So I'll just assume you need help doing these math functions, so here is some software that can do it for you.
A program called Sage.
http://www.sagemath.org/download-windows鈥?/a>
However, I personally use Derive 5, but I don't think they sell it anymore.
Vb.net How do i put data in a sql table that has a foreign key? invoice table has multiple ';start times'; table?
For each invoice, there is a foreign key to a start times table, each invoice has multiple start times.Vb.net How do i put data in a sql table that has a foreign key? invoice table has multiple ';start times'; table?
If the foreign key constraint has been defined for your invoice table, it will not allow any insert with a value that does not exist already in the 'start times' table. For multiple start times, this would work the same way, depending on just how you implemented that one-to-many relationship. The most normalized way would be a separate relation table like this:
Invoice table (invoice_number, ...)
Start_times table (start_timestamp, ...)
Invoice_time table (invoice_number, start_timestamp, date, duration, ...)
Here, the foreign-key relationship is moved down to the Invoice_time table, which allows however many time periods for the invoice as needed.
If the foreign key constraint has been defined for your invoice table, it will not allow any insert with a value that does not exist already in the 'start times' table. For multiple start times, this would work the same way, depending on just how you implemented that one-to-many relationship. The most normalized way would be a separate relation table like this:
Invoice table (invoice_number, ...)
Start_times table (start_timestamp, ...)
Invoice_time table (invoice_number, start_timestamp, date, duration, ...)
Here, the foreign-key relationship is moved down to the Invoice_time table, which allows however many time periods for the invoice as needed.
How to write a program in VB.NET to convert Integer values Into string?
please help me
i want to make a program in VB.NET in which two textbox and a button.
when we enter any value(currency) in first text box then its string value will show in second textbox.
for Ex-
Input
1200
Output
One thousand two hundred.
this program should work for upto 99 crores.How to write a program in VB.NET to convert Integer values Into string?
Copy The following codes into your program and then just pass the integer into the first function ConvertToSring() as shown below
Example :-
In the click event of button1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = Me.TextBox1.Text
Dim s As String
s = ConvertToSring(a)
Textbox2.Text = s
End Sub
Public Function ConvertToSring(ByVal num As Integer) As String 'Pass your value in this function
If num %26lt; 0 Or num %26gt; 999999999 Then
Return ';Invalid range';
End If
Dim numberString As String = ';';
Dim number As Integer = num
Dim onestens, hundred, thousandtenthousand, lakhstenlakhs, croretencrores As Integer
Try
onestens = number Mod 100
number = (number - onestens) / 100
hundred = number Mod 10
number = (number - hundred) / 10
thousandtenthousand = number Mod 100
number = (number - thousandtenthousand) / 100
lakhstenlakhs = number Mod 100
number = (number - lakhstenlakhs) / 100
croretencrores = number Mod 100
number = (number - croretencrores) / 100
Catch ex As Exception
End Try
If Not croretencrores = 0 Then
Dim sp As String 'singular or plural
Dim andstr As String 'and appender
If num Mod croretencrores = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
If croretencrores = 1 Then
sp = ';Crore ';
Else
sp = ';Crores ';
End If
numberString = numberString + TensFinder(croretencrores) + sp + andstr
End If
If Not lakhstenlakhs = 0 Then
Dim sp As String 'singular or plural
Dim andstr As String 'and appender
If (num - (croretencrores * 10000000)) Mod lakhstenlakhs = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
If lakhstenlakhs = 1 Then
sp = ';Lakh ';
Else
sp = ';Lakhs ';
End If
numberString = numberString + TensFinder(lakhstenlakhs) + sp + andstr
End If
If Not thousandtenthousand = 0 Then
Dim andstr As String 'and appender
If ((num - (croretencrores * 10000000)) - (lakhstenlakhs * 100000)) Mod thousandtenthousand = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
numberString = numberString + TensFinder(thousandtenthousand) + ';Thousand '; + andstr
End If
If Not hundred = 0 Then
Dim andstr As String 'and appender
If (((num - (croretencrores * 10000000)) - (lakhstenlakhs * 100000)) - (thousandtenthousand * 1000)) Mod hundred = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
Select Case hundred
Case 1
numberString = numberString + ';OneHundred '; + andstr
Case 2
numberString = numberString + ';TwoHundred '; + andstr
Case 3
numberString = numberString + ';ThreeHundred '; + andstr
Case 4
numberString = numberString + ';FourHundred '; + andstr
Case 5
numberString = numberString + ';FiveHundred '; + andstr
Case 6
numberString = numberString + ';SixHundred '; + andstr
Case 7
numberString = numberString + ';SevenHundred '; + andstr
Case 8
numberString = numberString + ';EightHundred '; + andstr
Case 9
numberString = numberString + ';NineHundred '; + andstr
End Select
End If
If Not onestens = 0 Then
numberString = numberString + TensFinder(onestens)
End If
Return numberString
End Function
Public Function TensFinder(ByVal twodigits As Integer)
If twodigits = 0 Then
Return ';Zero';
End If
Dim tens, ones, twodigits1 As Integer
twodigits1 = twodigits
Dim tensstring, twodigitstring As String
tensstring = ';';
twodigitstring = ';';
ones = twodigits1 Mod 10
twodigits1 = (twodigits1 - ones) / 10
If twodigits = 0 Then
GoTo label1
End If
tens = twodigits1 Mod 10
twodigits1 = (twodigits1 - tens) / 10
Select Case twodigits
Case 10
twodigitstring = ';Ten';
GoTo label2
Case 11
twodigitstring = ';Elevan';
GoTo label2
Case 12
twodigitstring = ';Twelve';
GoTo label2
Case 13
twodigitstring = ';Thirteen';
GoTo label2
Case 14
twodigitstring = ';Fourteen';
GoTo label2
Case 15
twodigitstring = ';Fifteen';
GoTo label2
Case 16
twodigitstring = ';Sixteen';
GoTo label2
Case 17
twodigitstring = ';Seventeen';
GoTo label2
Case 18
twodigitstring = ';Eighteen';
GoTo label2
Case 19
twodigitstring = ';Nineteen';
GoTo label2
Case Else
GoTo label3
End Select
label3: If Not tens = 0 Then
Select Case tens
Case 2
tensstring = ';Twenty ';
twodigitstring = ';Twenty';
Case 3
tensstring = ';Thirty ';
twodigitstring = ';Thirty';
Case 4
tensstring = ';Fourty ';
twodigitstring = ';Fourty';
Case 5
tensstring = ';Fiftey ';
twodigitstring = ';Fiftey';
Case 6
tensstring = ';Sixtey ';
twodigitstring = ';Sixtey';
Case 7
tensstring = ';Seventy ';
twodigitstring = ';Seventy';
Case 8
tensstring = ';Eighty ';
twodigitstring = ';Eighty';
Case 9
tensstring = ';Ninety ';
twodigitstring = ';Ninety';
End Select
End If
label1: Select Case ones
Case 1
twodigitstring = tensstring + ';One';
Case 2
twodigitstring = tensstring + ';Two';
Case 3
twodigitstring = tensstring + ';Three';
Case 4
twodigitstring = tensstring + ';Four';
Case 5
twodigitstring = tensstring + ';Five';
Case 6
twodigitstring = tensstring + ';Six';
Case 7
twodigitstring = tensstring + ';Seven';
Case 8
twodigitstring = tensstring + ';Eight';
Case 9
twodigitstring = tensstring + ';Nine';
End Select
label2: Return twodigitstring
End Function
'This Function Has some bugs in appending And to the String.But It won't affect the program
i want to make a program in VB.NET in which two textbox and a button.
when we enter any value(currency) in first text box then its string value will show in second textbox.
for Ex-
Input
1200
Output
One thousand two hundred.
this program should work for upto 99 crores.How to write a program in VB.NET to convert Integer values Into string?
Copy The following codes into your program and then just pass the integer into the first function ConvertToSring() as shown below
Example :-
In the click event of button1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = Me.TextBox1.Text
Dim s As String
s = ConvertToSring(a)
Textbox2.Text = s
End Sub
Public Function ConvertToSring(ByVal num As Integer) As String 'Pass your value in this function
If num %26lt; 0 Or num %26gt; 999999999 Then
Return ';Invalid range';
End If
Dim numberString As String = ';';
Dim number As Integer = num
Dim onestens, hundred, thousandtenthousand, lakhstenlakhs, croretencrores As Integer
Try
onestens = number Mod 100
number = (number - onestens) / 100
hundred = number Mod 10
number = (number - hundred) / 10
thousandtenthousand = number Mod 100
number = (number - thousandtenthousand) / 100
lakhstenlakhs = number Mod 100
number = (number - lakhstenlakhs) / 100
croretencrores = number Mod 100
number = (number - croretencrores) / 100
Catch ex As Exception
End Try
If Not croretencrores = 0 Then
Dim sp As String 'singular or plural
Dim andstr As String 'and appender
If num Mod croretencrores = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
If croretencrores = 1 Then
sp = ';Crore ';
Else
sp = ';Crores ';
End If
numberString = numberString + TensFinder(croretencrores) + sp + andstr
End If
If Not lakhstenlakhs = 0 Then
Dim sp As String 'singular or plural
Dim andstr As String 'and appender
If (num - (croretencrores * 10000000)) Mod lakhstenlakhs = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
If lakhstenlakhs = 1 Then
sp = ';Lakh ';
Else
sp = ';Lakhs ';
End If
numberString = numberString + TensFinder(lakhstenlakhs) + sp + andstr
End If
If Not thousandtenthousand = 0 Then
Dim andstr As String 'and appender
If ((num - (croretencrores * 10000000)) - (lakhstenlakhs * 100000)) Mod thousandtenthousand = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
numberString = numberString + TensFinder(thousandtenthousand) + ';Thousand '; + andstr
End If
If Not hundred = 0 Then
Dim andstr As String 'and appender
If (((num - (croretencrores * 10000000)) - (lakhstenlakhs * 100000)) - (thousandtenthousand * 1000)) Mod hundred = 0 Then
andstr = ';';
Else
andstr = ';And ';
End If
Select Case hundred
Case 1
numberString = numberString + ';OneHundred '; + andstr
Case 2
numberString = numberString + ';TwoHundred '; + andstr
Case 3
numberString = numberString + ';ThreeHundred '; + andstr
Case 4
numberString = numberString + ';FourHundred '; + andstr
Case 5
numberString = numberString + ';FiveHundred '; + andstr
Case 6
numberString = numberString + ';SixHundred '; + andstr
Case 7
numberString = numberString + ';SevenHundred '; + andstr
Case 8
numberString = numberString + ';EightHundred '; + andstr
Case 9
numberString = numberString + ';NineHundred '; + andstr
End Select
End If
If Not onestens = 0 Then
numberString = numberString + TensFinder(onestens)
End If
Return numberString
End Function
Public Function TensFinder(ByVal twodigits As Integer)
If twodigits = 0 Then
Return ';Zero';
End If
Dim tens, ones, twodigits1 As Integer
twodigits1 = twodigits
Dim tensstring, twodigitstring As String
tensstring = ';';
twodigitstring = ';';
ones = twodigits1 Mod 10
twodigits1 = (twodigits1 - ones) / 10
If twodigits = 0 Then
GoTo label1
End If
tens = twodigits1 Mod 10
twodigits1 = (twodigits1 - tens) / 10
Select Case twodigits
Case 10
twodigitstring = ';Ten';
GoTo label2
Case 11
twodigitstring = ';Elevan';
GoTo label2
Case 12
twodigitstring = ';Twelve';
GoTo label2
Case 13
twodigitstring = ';Thirteen';
GoTo label2
Case 14
twodigitstring = ';Fourteen';
GoTo label2
Case 15
twodigitstring = ';Fifteen';
GoTo label2
Case 16
twodigitstring = ';Sixteen';
GoTo label2
Case 17
twodigitstring = ';Seventeen';
GoTo label2
Case 18
twodigitstring = ';Eighteen';
GoTo label2
Case 19
twodigitstring = ';Nineteen';
GoTo label2
Case Else
GoTo label3
End Select
label3: If Not tens = 0 Then
Select Case tens
Case 2
tensstring = ';Twenty ';
twodigitstring = ';Twenty';
Case 3
tensstring = ';Thirty ';
twodigitstring = ';Thirty';
Case 4
tensstring = ';Fourty ';
twodigitstring = ';Fourty';
Case 5
tensstring = ';Fiftey ';
twodigitstring = ';Fiftey';
Case 6
tensstring = ';Sixtey ';
twodigitstring = ';Sixtey';
Case 7
tensstring = ';Seventy ';
twodigitstring = ';Seventy';
Case 8
tensstring = ';Eighty ';
twodigitstring = ';Eighty';
Case 9
tensstring = ';Ninety ';
twodigitstring = ';Ninety';
End Select
End If
label1: Select Case ones
Case 1
twodigitstring = tensstring + ';One';
Case 2
twodigitstring = tensstring + ';Two';
Case 3
twodigitstring = tensstring + ';Three';
Case 4
twodigitstring = tensstring + ';Four';
Case 5
twodigitstring = tensstring + ';Five';
Case 6
twodigitstring = tensstring + ';Six';
Case 7
twodigitstring = tensstring + ';Seven';
Case 8
twodigitstring = tensstring + ';Eight';
Case 9
twodigitstring = tensstring + ';Nine';
End Select
label2: Return twodigitstring
End Function
'This Function Has some bugs in appending And to the String.But It won't affect the program
Subscribe to:
Posts (Atom)