Utilize String "*" Or "" As Mathematical Operators?
Sep 17, 2010
I want to use "*" or "" as mathematical operators as such:
[code...]
this in one line without building a long, complex function? I would also like for this to be something that is already a part of the VB.NET structure and doesn't require an import.If such a solution does not exist how do I do it with a function or .dll import?
I recently installed visual studio 2010 and am using visual basic.The problem I am having is that some operators do not show up within the editor. For example the code line below test = 3 + 5 - 6 / 7 * 4
only displays
test 3 5 - 6 / 7 * 4
the = + operators are not visible although they are there since the program will work as intended....and if I open up the .vb file in notepad everything is there. It just won't display within Visual Studio.
I am making a simple calculator that will evaluate functions I have a entry box and the user types in simple equations i.e. 1+4*3/5=? how would i make this evaluate the string?
I have a simple routine to find the next object based on a name property in an un-ordered collection of objects. I go through the collection and collect all the names in a List(of String) adding any names that are > my current name, which should give a list of everything that comes after the current key. I then sort the list using the default .Sort() method on the List(of String) and take the first item in the list, which should be my next item. I do the reverse to find the previous item, add all items < my current name, sort, and take the last item in the list.
However, this method skips over some items. For example I have items named 1210, 1210-ADA, and 1210_ADA_DB. Using this method, getting the next item skips the middle item 1210-ADA and finds 1210_ADA_DB, but finding the previous item seems to work.
I'm having the reverse problem as this thread.We save off data in several formats, one of which is .XLS, however, some users may not have MS Office installed already, so I want to allow them to use the OS's "open with" dialog to associate with notepad or something so they can open the file.[code]...
I have a messagebox with a "yes" and "no" buttons. I am asking the user upon "exit" (ing) the app, if they haved saved their work. The default button is defaultbutton2 "no" and it saves the file. If user selects "yes" they have saved their work, then I need the app to close.Here's the code:
'show messagebox to save work....default button2 = 'no' then saves file....default button1 'yes' is spose to close app MessageBox.Show(
"Have you saved your work?",
"Garman Music Pro", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, 0, HelpButton)
If MessageBoxDefaultButton.Button2 = MessageBoxDefaultButton.Button2
However, I am wondering if there are any workarounds or plans for incorporating this feature into VB.NET in the future?What I'd like to do:
Public Delegate Function Deserializer(Of T)(ByRef Buffer() As Byte, optional ByRef BufferPosition As Integer = 0) As T 'Implementation of a func that matches the delegate' Class A Public Function Deserialize(Byref Buffer() as Byte, optional Byref BufferPosition as integer = 0) ....
In the absence of specifying "optional" inside the actual delegate itself, it'd at least be nice to be able to do it in the function implementation only:
Public Delegate Function Deserializer(Of T)(ByRef Buffer() As Byte, ByRef BufferPosition As Integer) As T 'Implementation of a func that matches the delegate' Class A Public Function Deserialize(Byref Buffer() as Byte, optional Byref BufferPosition as integer = 0) ....
At least this second way, the functions for the delegate will always have a value mapped to each parameter, although some may come from the function side and not the calling side.
I am currently building a vb windows form application (.net 3.5 framework). For the next part of the application I want to be able to use an existing excel process which will have been checked out from sharepoint and manipulate the worksheet with my app.
For sometime now, we have developed an applicatio in Visula Basic (Express Edition). We would like to utilize the 64-bit processing power available in Windows 7 (our application runs currently in a Windows XP environment). So we are contemplating to migrate our VB application from a Windows XP-based environment to a 64-bit hardware platform running on Windows 7.
What is the best way to log into a website from a program. I can login using a web address. But I can't figure out how to utilize the web address and get it to log me in. I'm not too sure how to go about getting a login to work really. What is the best way to go about this? It is just a PHP-based website.
I must convert string data from a CNC that is arithmetic expression to a number that I can use in a VB application that I wrote. The following is what I get out of the cnc. [18722*65536+19377]/67108864. I need to evaluate this expression in my VB ap. The format of the string is not always the same as what I have illustrated.
let's say I create a basic windows form with 100 textboxes, and create a variable that starts at 0, and counts up to 100. How could I pseudo-effortlessly have, for example, textbox7, when the variable is at 7, display a piece of text, instead of writing 100 lines of code such as
if vara = 7 then textbox7.text = "hello"
is there a way to utilize something in the nature of LINQ, where you could somehow say,
if vara = 7 then textbox & varA & .text = "hello"
this is just an example, I know it will not work, after paying a small bit of attention to the likeliness and possibility.....
I would like to utilize classes that inherit the System.Data name space.Specifically, I would like to have classes CarColumn, CarTable, and CarSet derived from DataColumn, DataTable, and Dataset respectively.I would like to be able to add additional properities to each class. As an example this is how I would like to reference items within the classes:
I have two unrelated databases and I need to pass data back and forth between them. Right now I have created two separate entity models - one for each database - but this is causing issues in my code b/c I have to do a Using nameofcontext / End Using and when I try to then use some of the results from the first section of the code in a second Using nameofcontext / End Using it doesn't like it - b/c I've closed the connection to the first database!
figuring out which multithreading approach to utilize in my current work project. Since I've never written a multithreaded app in my life, this is all confusing and very overwhelming.I've been assigned to take over work on a control application for a piece of test equipment in my companies R&D lab. The program has to be able to send and receive serial communications with three different devices semi-concurrently. The original program was written in VB 6 (no multithreading) and I did plan on just modding it to work with the newer products that need to be tested until it posed a safety hazard when the UI locked up due to excessive serial communications during a test. This resulted in part of the tester hardware blowing up, so I decided to try rewriting the app in VB.Net as I'm more comfortable with it to begin with and because I thought multithreading might help solve this problem.
My plan was to send commands to the other pieces of equipment from the main app thread and spin the receiving ends off into their own threads so that the main thread wouldn't lock up when timing is critical. However, I've yet to come to terms with my options. To add to my problems, I need to display the received communications in separate rich text boxes as they're received while the data from one particular device needs to be parsed by the main program, but only the text that results from the most current test (I need the text box to contain all received data though).
So far, I've investigated delegates, handling the threads myself, and just began looking into BackgroundWorkers. I tried to use delegates earlier today, but couldn't figure out a way to update the text boxes. Would I need to use a call back function to do this since I can't do it in the body of the delegate function itself? The problem I see with handling threads myself is figuring out how to pass data back and forth between the thread and the rest of the program. BackgroundWorkers, as I said, I just started investigating so I'm not sure what to think about them yet.
i got bored earlier so instead of doing my Maths homework i thought what the hell why dont i make a program to do it for me. The problem is im getting an error with my NCR function.For those of you who dont know NCR is used in calculating Statistics generally it goes like this
heres the problem lets assume i have a label1 which its text is "(y+1)"i defined an integer, lets assume its x i made some operations up and lets say there can be diffrent results and i want to replace y with that math ops result and then define x as it writes in label1..
How to load file and save it as different filename? It saves almost twice the original size for some reason?
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim iFile As System.IO.File[code].....
Question 02:How to load it as numerical values?
Question 03:How to try applying an array of mathematical functions to the numerical values to see if size reduction is possible: I want to try testing all mathematical functions with any and all mathematical values of smaller size to see if the file can be compressed.
Is there a way to create new mathematical equations at runtime? Obviously you can pass new variables to a given equation, but I need to make a new equation altogether (then give it variables).
I've got a program which starts with welcome screen "Enter the number of the random variables X" and this number refers to the columns. If it is entered 5 => a DataGridView will be created with 5 columns and 2 rows (first one is for random variable entered by the user, and the second is for probability). For example:I have to multiply x1 with probability p1, value x2 with probability p2, and so on. So EX = x1*p1 + x2*p2 +... Here comes the question - how to multiply and then add them?There are only 2 rows, that's how much I need :I've enabled only 2 rows, that's how much I must have for this program:
Const allowedRows As Integer = 2 Private Sub DataGridView1_UserAddedRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) Handles DataGridView1.UserAddedRow
This is my way the dynamically generate a mathematical equation everytime the button is click. However, I want the combobox or the numericupdown turn disabled when the next question show out. For example, if the question N is generated, the combobox and numericupdown of question generated before N must be disable means that the user only can input to the current question but cant change the answer of the previous question?
Private Sub btnnext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnext.Click If counter < 10 Then Dim pnl As New Panel pnl.Height = 40 pnl.BorderStyle = BorderStyle.FixedSingle [Code] .....
i want to make a program in which the user can input a mathematical function so the program can then work with it. So the user would input something like x^4+x+2 and then an x and the program would calculate f(x). What i don't know is how to let the user input the function.
I am trying to get a better understanding of the uses of arrays in programing, and have been wondering why do programmers use an array when working with mathematical concept such as Fibonacci sequences? why are arrays so prevalent in coding now a days.
How to use the signs "+", "-", "*", "/" as label text randomly. I am trying to create a math game for my kids. There I need a random sign to display every time they get new question to solve. I am able to display values [random numbers] but could not able to use this signs randomly as a single label text.
I am currently using double data types. The problem I am encountering is that sometimes the user will have to input a value of 0 in the required text box and this creates an error. My question is what data type will allow the user to input 0 and allow the mathematical functions to work properly. Decimals maybe?