|
Is there anyway to translate this Excel program into a VB.Net one ?
The Program goes like this:
I enter 2 fields : Density & Temperture .
They will be converted and used later on to get the Coefficient , The putput is Tabel ASTM table 54-B
2 Input Boxes: in locations
I8 and J8
Box K8
=IF((J8*100)-INT(J8*100)<0.1,INT(J8*100),IF((J8*100)-INT(J8*100)<0.3,INT(J8*100)+0.2,IF((J8*100)-INT(J8*100)<0.5,INT(J8*100)+0.4,IF((J8*100)-INT(J8*100)<0.7,INT(J8*100)+0.6,IF((J8*100)-INT(J8*100)<0.9,INT(J8*100)+0.8,(INT(J8*100)+1))))))*10
Box L8
=IF(K8<=771,(346.4228/K8^2)+(0.4388/K8),(IF(K8>=771.1,(IF(K8<=787,(2680.3206/K8^2)-0.00336312,(IF(K8>=787.1,(IF(K8<=838.49,(594.5418/K8^2),(IF(K8>=838.5,(IF(K8<=1075.5,(186.9696/K8^2)+(0.4862/K8))))))))))))))
Output Box M8
=(ROUND(EXP(-L8*(I8-15)-0.8*(L8^2)*((I8-15)^2)),4))
|
|
|
|
|
You have an excel formula and you want to write a VB program that does the same ? Seems pretty simple to me, do you know any VB ? If you don't and you have no intention to learn, it could save you some grief to just pay someone to write this for you.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hy,
I just wanted VB.Net program or formula that do the same job as the Excel one. That's all. I couldn't read well the Excel formula & I need to use i in VB.Net.
J ,
|
|
|
|
|
Hii
Use like this
myworksheet.cells(11,8).Formula= "IF((J8*100)-INT(J8*100)<0.1,INT(J8*100), _
IF((J8*100)-INT(J8*100)<0.3,INT(J8*100)+0.2,IF((J8*100)-INT(J8*100)<0.5,INT(J8*100)+0.4, _
IF((J8*100)-INT(J8*100)<0.7,INT(J8*100)+0.6,IF((J8*100)-INT(J8*100)<0.9,INT(J8*100)+0.8,(INT(J8*100)+1))))))*10"
may be this helps you.
Thanx
~Khatri Mitesh
|
|
|
|
|
I have a dropdown list box on in a web application.
When a user clicks on an item, I want it to
be removed from the list. Below is my code for doing that:
Protected Sub ddlSelected_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlSelected.SelectedIndexChanged
If ddlSelected.SelectedIndex <> -1 Then
ddlSelected.Items.RemoveAt(ddlSelected.SelectedIndex)
End If
End Sub
My problem is, when a user clicks on the last item in the list, it does
not get removed. How do i handle this?
|
|
|
|
|
HI,
Here is an alternative,
would you consider trying to clear the drop downlist seeing that it is the last item in the list.
me.dl.items.clear()
just a thought,
Thanks
Anoop
|
|
|
|
|
|
Hi ,
i am using vs2005 and tried using the below command...it works for me...
If Me.dlCustomers.Items.Count = 1 Then Me.dlCustomers.Items.Clear()
not sure why it wont work for you....
sorry!
|
|
|
|
|
Here's the new code i'm using:
If ddlSelected.SelectedIndex <> -1 Then
ddlSelected.Items.RemoveAt(ddlSelected.SelectedIndex)
ElseIf Me.ddlSelected.Items.Count = 1 Then
Me.ddlSelected.Items.Clear()
End If
Still won't work because if there's only ONE item in the list, there's no
textchange event to fire nor indexchange event to fire.
Anyway, I changed the dropdownlist box to a regular listbox and my code works fine.
I appreciate the help.
|
|
|
|
|
The way you have this written, the If Me.ddlSelected.Items.Count=1 statement will never be executed. If the user has selected the last item on a list, then If ddlSelectedIndex <> -1 is TRUE, and so the ElseIf statement is never reached.
Try:
If ddlSelected.SelectedIndex <> -1 Then
If ddlSelected.Items.Count = 1 Then
Me.ddlSelected.Items.Clear()
Else
ddlSelected.Items.RemoveAt(ddlSelected.SelectedIndex)
End If
|
|
|
|
|
hi all,
i want to ask whether math class contain any function which accept an array of point (coordinate) and return whether it is point of straight line or half circle or full circle
|
|
|
|
|
No
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
You will have to make one
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
No, there is no such method in the framework.
If there were such a method it would not be in the Math class, it would be somewhere in the System.Drawing namespace where the Point structure is.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
I have an application like Optimize System Performance by using Memory speed, cpu speed and Disk speed.
How to optimize memory speed,disk optimization and CPU optimization.
Please provide me some sample source code to optimize system performance.
Thanks
pavani
|
|
|
|
|
Isn't that the job of the operating system?
|
|
|
|
|
ROTFL. It's amazing what people expect VB to be able to do, nowadays....
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
hi,
I have an application that will find Firefox browing history, Auto complete datalist, Temp offline files and Find Computer list.
please give me some idea on Auto complete datalist, Temp offline files and Find Computer list.
I tried this task using path
C:\documents and settings\eminosoft\Application Data\Mozilla\Firefox\Profiles\38v4t6d1.default
But in that path there are 4 .dat files
history.dat
formhistory.dat
persdict.dat etc.
what is the use of each file and if I want to delete auto complete datalist from firefox which file i will use?
Thanks in advance
pavani
|
|
|
|
|
I have a word file and I wish to extract certain information from it. For example, i wish to extract the filds called info of interest:
using vb.net or c#.net
News: Info of interest
Title: Info of interest
DAte: Info of interest>
Subject: info of interest
I want to be able to:
-Open doc file
-Read first line
- extract the <info of="" interest=""> .
-Go to next line & repeat process until end of file.
Can anyone help please????
Thanks
REjith
code
Imports System.IO.File
Imports sqld
Public Class Form1
Private ob1 As sqld.sqld.sqldb
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
ob1 = New sqld.sqld.sqldb()
' Add any initialization after the InitializeComponent() call.
End Sub
Private WordApp As New Word.ApplicationClass()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.Filter = "Word Documents|*.doc"
txtFileName.Text = OpenFileDialog1.FileName
OpenFileDialog1.ShowDialog()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim WordApp As New Word.ApplicationClass()
Dim file As Object = OpenFileDialog1.FileName
'Dim wdLineType1 As Word.WdLineType = Word.WdLineType.wdTextLine
Dim nullobj As Object = System.Reflection.Missing.Value
Dim doc As Word.Document = WordApp.Documents.Open(file, nullobj, nullobj, nullobj, nullobj, nullobj, _
nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, _
nullobj, nullobj, nullobj)
doc.Activate()
'Dim st As System.Type
'st = wdLineType1.GetType
'Dim doc1 As Word.Document = WordApp.ActiveDocument
Label2.Text = doc.Range(0, 9).Text
' Label2.Text += " " + doc.'wdLineType1.GetValues(st).GetValue(1).ToString
'Dim m_Content As String = doc1.Content.Text
'Label2.Text = m_Content
'doc.ActiveWindow.Selection.WholeStory()
'doc.ActiveWindow.Selection.Copy()
'Dim data As IDataObject = Clipboard.GetDataObject()
''Do whatever with the text.
'Label2.Text = data.GetData(DataFormats.StringFormat)
'Close doc and shutdown Word application.
doc.Close(nullobj, nullobj, nullobj)
WordApp.Quit(nullobj, nullobj, nullobj)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim temp As String = Label2.Text.ToString()
Dim ch As Char() = {":"}
Dim str1 As String() = Label2.Text.Split(ch)
Try
For i As Integer = 0 To str1.GetUpperBound(0)
'MessageBox.Show(str1(3).ToString())
'Dim str22 As String = ob1.insertNData(str1(1), str1(3), str1(5), str1(7)).ToString()
i = i + 1
Next
Catch ie As IndexOutOfRangeException
ie.ToString()
End Try
End Sub
End Class
please help
|
|
|
|
|
Do NOT post similar questions more than once right next to each other in the same forum. Along with that you should also use the code blocks to make your messages more readable.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
here is my code
Imports System.IO.File
Imports sqld
Public Class Form1
Private ob1 As sqld.sqld.sqldb
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
ob1 = New sqld.sqld.sqldb()
' Add any initialization after the InitializeComponent() call.
End Sub
Private WordApp As New Word.ApplicationClass()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.Filter = "Word Documents|*.doc"
txtFileName.Text = OpenFileDialog1.FileName
OpenFileDialog1.ShowDialog()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim WordApp As New Word.ApplicationClass()
Dim file As Object = OpenFileDialog1.FileName
'Dim wdLineType1 As Word.WdLineType = Word.WdLineType.wdTextLine
Dim nullobj As Object = System.Reflection.Missing.Value
Dim doc As Word.Document = WordApp.Documents.Open(file, nullobj, nullobj, nullobj, nullobj, nullobj, _
nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, _
nullobj, nullobj, nullobj)
doc.Activate()
'Dim st As System.Type
'st = wdLineType1.GetType
'Dim doc1 As Word.Document = WordApp.ActiveDocument
Label2.Text = doc.Range(0, 9).Text
' Label2.Text += " " + doc.'wdLineType1.GetValues(st).GetValue(1).ToString
'Dim m_Content As String = doc1.Content.Text
'Label2.Text = m_Content
'doc.ActiveWindow.Selection.WholeStory()
'doc.ActiveWindow.Selection.Copy()
'Dim data As IDataObject = Clipboard.GetDataObject()
''Do whatever with the text.
'Label2.Text = data.GetData(DataFormats.StringFormat)
'Close doc and shutdown Word application.
doc.Close(nullobj, nullobj, nullobj)
WordApp.Quit(nullobj, nullobj, nullobj)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim temp As String = Label2.Text.ToString()
Dim ch As Char() = {":"}
Dim str1 As String() = Label2.Text.Split(ch)
Try
For i As Integer = 0 To str1.GetUpperBound(0)
'MessageBox.Show(str1(3).ToString())
'Dim str22 As String = ob1.insertNData(str1(1), str1(3), str1(5), str1(7)).ToString()
i = i + 1
Next
Catch ie As IndexOutOfRangeException
ie.ToString()
End Try
End Sub
End Class
in my word document four lines
i need to cut each line
how can i read word document line by line
please
help
|
|
|
|
|
hi i've created a form which edit & diaplayes data into a data grid..
when i save data through Save button click data gets saved but if i (after entering 3-4 records) press shortcut key as <Alt + S> last record from the data grid not get saved .. even this is not displayed in the datasource during debug ...
i added a code because datagrid doesnt displayed next column without hitting the keys on last column...
If dgdcoccmast(dgdcoccmast.CurrentCell.RowNumber, 0).ToString <> "" Then
Dim cm1 As CurrencyManager = Me.BindingContext(Me.dgdcoccmast.DataSource)
cm1.EndCurrentEdit()
End If
but the problem remains....
Please help
|
|
|
|
|
What code did you write to make this shortcut key work ? How has the debugger led you to believe that it should be saving ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Sir,
its not the shortcut key code since this shortcut is just to focus the Save button '&Save' event is firing is the btnSave_click only.. but in the datatable which i m using & binding to datagrid is not considering the last record because user is not hitting any key to generate the new row in the datagid instead it just saving the data....
|
|
|
|
|
OK, so you need to write code that detects that a record has not been saved, based on key presses in the grid ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|