|
Just be advised that if you follow those steps and hide form1, the resources allocated with it still exist. The form really still exists but you can't see it.
|
|
|
|
|
Hello Everybody in this Discussion board!
I want to take input (like 2x^2+Sinx-log(x)-9) from user and then want to calculate its value at any value of x (like 2.6), then what should i do in VB.NET?
Thanx in advance for your assistance
Bye
Arfan Qadir
|
|
|
|
|
All you have to do is search the articles for "math expression parser"[^] and you'll come up with a bunch of examples.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Anyone know how to write a service to receive faxes?
|
|
|
|
|
The scenario can be best described as the following.
A form is created with only a label. A keyup event is added to the form so that when a key is pressed the value of that key is added to the label.
Now when I add a couple of radio buttons and a standard button to the same form, this procedure does not work.
I want the form to handle the key event not some control. Why can I not set the form to have focus when other controls are present?
I hope this makes sense!
Thanks!
|
|
|
|
|
Set the KeyPreview propery of your form to TRUE.
|
|
|
|
|
Hello,
I am trying to export the contents of a datagrid to Excel.
Here's the code I have so far:
<small> 'Fire up an Excel instance
Dim ExcelApp As New Excel.Application
ExcelApp.Visible = True
Dim workbooks As Workbooks = ExcelApp.Workbooks
Dim workbook As _Workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet)
Dim sheets As Sheets = workbook.Worksheets
Dim worksheet As _Worksheet = CType(sheets.Item(1), _Worksheet)
'Put some data on the Worksheet -- This doesn't work, but throws no errors
Dim nCell As Integer = 5
Dim Range2 As Range = worksheet.Range("A1", "E1")
Dim array2(nCell) As Integer
Dim i As Integer
For i = 0 To (array2.GetLength(0)) - 1
array2(i) = i + 1
Next
Dim args2(1) As Object
args2(0) = array2
Range2.GetType().InvokeMember("Value", BindingFlags.SetProperty, Nothing, Range2, args2)</small>
Everything works except the last line. Actually, the only thing I have been successful at doing was getting the Excel app to fire up. Beyond that I am left looking at beautiful, although empty, white cells.
I'm using VS.Net 2005 latest beta.
It seems simple enough... Read a datagrid, send the results to an Excel worksheet. I would use the more accepted method of using Response.Write, but due to our website configuration, things get all screwed up with using a Master page and <form> tags.
If anyone can help me out of this bind, I would be a very happy programmer.
|
|
|
|
|
AFAICT, you can't bind an array to an Excel Range. You have to inster the values into the cells, one at a time.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
...that seems to be where I am stuck at - inserting the values one at a time.
Using the code:
Dim args1(1) As Object
args1(0) = nCell
Range1.GetType().InvokeMember("Value", BindingFlags.SetProperty, Nothing, Range1, args1)
..I get an error that states: "Public member 'GetType' on type 'Range' not found."
Since I'm using VS.Net 2005, I am wondering if there is a library I am missing or if the function has been removed altogether.
That is where I am at. Inserting the data, even a single cell value is proving to be my ticket to insanity. So close, yet so far.
|
|
|
|
|
First, the Range object is a little more difficult to use when filling in cells like this. The Cells object lets you index rows and columns sperately. Second, I'm wondering why your going through all the InvokeMember stuff when a simple assignment will do:
For I As Integer = 1 to 5
worksheet.Cells(I, 1) = I
Next
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I had no idea it could be that simple. This is a project for work (I'm normally a DBA by trade) and I'll plug in first thing Monday morning and give this a whirl.
You have been incredibly helpful, Dave and I really appreciate your expertise.
(I was just about to give up on this whole Excel thing and tell my boss if he wants the info on the website, just copy/paste it...
I'll let you know Monday how it all works out. If I can get just one cell to reflect info off the ASP page, I'll consider this a success.
Ray
|
|
|
|
|
Dim CRApp As New CRAXDRT.Application<br />
Dim CRRpt As New CRAXDRT.Report<br />
Dim CRTbl As CRAXDRT.DatabaseTable<br />
<br />
Set CRRpt = CRApp.OpenReport(App.Path & "\Reports\Products.rpt)<br />
CRViewer.ReportSource = CRRpt<br />
CRViewer.ViewReport
I am using Password Protected Access Database, Report show only those records which were recorded before report designing. On Execution the code given above ,there is no error. While Refreshing report pressing refresh button from
Report Viewer causes an error dexcribed as under:
Logno Failed.
Details: ADO Error Code: 0x80040e4d
Source:Microsoft JET database Engine
Description: Not a Valid Password
SQL State: 3031
Native Error: -124782449
Shoaib Nawaz
|
|
|
|
|
Greetings!
If I have a control in a split-panel, which is in a tab control, which is in a form -- how can I obtain the absolute location of the original (button) control?
Dim o As Control = LogPhotosToDbBtn
Dim x As Integer = LogPhotosToDbBtn.Location.X
Dim y As Integer = LogPhotosToDbBtn.Location.Y
While (o.Parent.Name <> "")
o = o.Parent
x += o.Location.X
y += o.Location.Y
End While
Dim p1 As Point
p1.X = x
p1.Y = y
LogFotosForm.Show()
LogFotosForm.Location = p1
X and Y are never incremented because o.Parent.Name always return "".
Is there a better way (one that actually works) of trying to do this?
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Have you tried stepping through this in debug mode?
The line:
o = o.Parent will fail when you get to the form level because the form has no parent object.
That may be part of your problem ...
|
|
|
|
|
I did try to debug it, it never enters the while loop -- even tho the control is buried in several levels of parent containers.
Does o.Parent.Name return the parent's container's Name property?
If not, what does?
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
watagal wrote:
Does o.Parent.Name return the parent's container's Name property?
It should. This works in Net 2002/2003.
|
|
|
|
|
watagal wrote:
Greetings!
If I have a control in a split-panel, which is in a tab control, which is in a form -- how can I obtain the absolute location of the original (button) control?
See non-working code in original post
X and Y are never incremented because o.Parent.Name always return "".
Is there a better way (one that actually works) of trying to do this?
Ok, figured out what was happening: The first parent above my button was a split panel, while the actual split panel returns the correct Name -- the Panel1 container within the split panel container does not return a Name (I guess because you can not assign it a name). Therefore, my while loop was never entered.
Here's code that does work:
Dim o As Control = uxLogPhotosToDbBtn
Dim x As Integer = 0
Dim y As Integer = 0
While (Not o Is Nothing)
x += o.Location.X
y += o.Location.Y
o = o.Parent
End While
Dim p1 As Point
p1.X = x
p1.Y = y
uxcLogFotosForm.Show()
uxcLogFotosForm.Location = p1
Thanks again for all the help,
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Now that I have accomplished what I wanted to do, Is there a faster better easier way to do this somewhat common task?
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Here you go, i'll be happy to give some explanation if you want.
Imports System.Runtime.InteropServices
Public NotInheritable Class Api
<StructLayout(LayoutKind.Explicit)> _
Private Structure RECT
<FieldOffset(0)> Public left As Integer
<FieldOffset(4)> Public top As Integer
<FieldOffset(8)> Public right As Integer
<FieldOffset(12)> Public bottom As Integer
End Structure
<DllImport("User32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
Private Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef lpRect As RECT) As Boolean
End Function
''' <summary>Get the location of a control in screen coordinates.</summary>
''' <param name="control">The control who's location will be returned.</param>
''' <returns>Returns the location of the control in screen coordinates.</returns>
Public Shared Function AbsoluteLocation(ByVal control As Control) As Point
If (control Is Nothing) Then Throw New ArgumentNullException("control")
Dim rect As New rect
GetWindowRect(control.Handle, rect)
Return New Point(rect.left, rect.top)
End Function
End Class
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Greetings!
The following code sends my program into a infinite loop.
Public Class LogFotosForm
Private Sub PreviewFotoChkBx_CheckedChanged( _
ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles PreviewFotoChkBx.CheckedChanged
If PreviewFotoChkBx.Checked Then
PreviewFotoChkBx.Checked = False
Me.Width = 320
Else
PreviewFotoChkBx.Checked = True
Me.Width = 450
End If
End Sub
End Class
I want to resize my form when the checkbox changes - once the checkbox is True.
Should I be using a different event?
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
You're already In the "Changed" event, you don't need to change the valud a second time, doing so causes the event to be refired, and since you're toggling the value you get an infinite loop.
Take out the "PreviewFotoChkBx.Checked" lines and I think it will do what you want it to do.
|
|
|
|
|
look the problem is u r using the function PreviewFotoChkBx_CheckedChanged which handels the checkbox checked property.and in it the if condition you r changeing the property againg so function calles it self again and ur programe goes in infinite loop. insted of using checked property(handling checkedchanged)use click then it will work fine.best of luck
GET BACK 2 ME
|
|
|
|
|
OK. I have to giggle a little bit here.
Follow your code. This is the CheckedChanged event right?
Well, if the user clicks on a empty checkbox, the value of Checked changes to True , right? This fires the CheckedChanged event, not because the box was checked, but because the value of Checked was altered. Now, in your code, you check the value of Checked , then change it to the opposite of what it is set to. This fires the CheckedChanged event again because, well, you changed it! Guess what happens next...
Why are you changing the value of Checked at all? Don't! As far as I can tell, you don't need to do it for any reason. All your doing is changing the size of the form based on whether the checkbox is checked or not. Why is your code changing the checkbox value?
Eliminate the lines that are changing the checkbox:
Public Class LogFotosForm
Private Sub PreviewFotoChkBx_CheckedChanged( _
ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles PreviewFotoChkBx.CheckedChanged
If PreviewFotoChkBx.Checked Then
Me.Width = 320
Else
Me.Width = 450
End If
End Sub
End Class
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dooh!
I promise to think next time before asking. No I'm not blond!
Thanks to all!!
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
I have an application which contains the database connection string plus some other keys containing file paths that the user needs to use stored on key at the app.config file of the application. Is there a way that I can let the user modify the value for those paths when installing the application? this is because depending on where the application is installed the user decide where to store some files, and that's what those paths in the app.config file are for. I created a msi installer for my application, but I haven't found (and still don't know if it's possible) how to let the user set properties to the app.config file when using my installer file.
Any help will be greatly appreciated
|
|
|
|