|
dont ever put you email on a fourm
Tamimi - Code
|
|
|
|
|
=) thank you.
i have done the codings for each individual buttons.
Eg for the button 9:
Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
TextBox1.Text = 9
temp = 9
End Sub
However, I can't figure out what should the code of '+' be.
Since when a user clicks on it, he/she will select another number button.
So is it simply this:
TextBox1.Text = Int(TextBox1.Text) + Int(TextBox1.Text)
|
|
|
|
|
Here are some pointers:
You need to hold some state somewhere. You also need to hold the fact that the user can type numbers like 98 (the code you showed does not append more digits, it replaces them).
When a use clicks on an operator button (+-/*=) the program needs to store the current display, then it needs to accept a new number. When the user next pressed an operator it performs the function of the operator on the stored value and the current value.
When a user clicks on a digit button it has to append the value on to the other digits received.
|
|
|
|
|
You got the response you did because we don't do people's homework here. If you try to do your own homework, then we're happy to help with specifics.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have some idea for you:
A. For the numeric buttons write scrip like this:
<br />
private sub btn1_click(..)<br />
txtT.text = txtT.text & "1<br />
end sub<br />
<br />
' etc. for all numeric buttons<br />
B. For command buttons ( + - * / etc. ) write this script:
<br />
private sub plus_click(..)<br />
Tmp1 = cint(txtT.text)<br />
act="plus"<br />
txtT.text=""<br />
end sub<br />
C. For = button write:
<br />
private sub ans_click(..)<br />
Tmp2 = cint(txtT.text)<br />
select case act<br />
case "plus" : txtT.text = tmp1+tmp2<br />
case "minus" : txtT.text = tmp1-tmp2<br />
....<br />
end select<br />
end sub<br />
This code handle only one action per two numbers.
If you wans to handle lot of actions, like windows calculator, you need to add a boolean trigger that will be True if one action had been chosen and when the user select another action it will do the action selected before, then put the result in Tmp1 and then reset the trigger to False. This process will continue until the user click the = button.
I'll don't give the answer for this so quickly .. I give you time to think about it.
|
|
|
|
|
=) thank u! i'll try later.
oh ya. do you know of some websites which have tutorials? our lecturers just threw us this homework without giving any help...
once again, thanks! hope you have a great day!!
|
|
|
|
|
aurora56 wrote: do you know of some websites which have tutorials?
Well, based on this question
aurora56 wrote: our lecturers just threw us this homework without giving any help...
I suspect this is not true.
Giving you code is not helping you. The answer to all of this is just a google away. If you can't do the most basic research, you need to quit your course.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Has Christian Graus said, if you can't do the basic research source codes may not help you.
The idea of programming is to think about the algorithm you want to write and then think how to make it work in the easiest and quickly way you can. The speed is not only for saving project develop time yet also to increase the computer efficient. Processing resources is an expensive resource.
There are few tips for you, when you want to write a computer program:
1. Define your needs and targets and the system the program will run over it (ex. windows XP, CE, Mobile Phone, etc.)
2. Multiply the targets into missions and sub-missions that will be easy to implement.
3. After you define the targets try to write algorithm (not in VB but in piece of paper) this will help you to rearrange your minds and way of work. you may also draw your tasks to think about visually.
4. The next step is to write it in VB and debugging.
Good Luck !
Web site with source codes: http://www.planetsourcecode.com/
You may use such web sites (you may find a lot of them in one Google simple search) only for helping you with scripts you can't think about your own algorithm. those sites are not good for learning from the beginning.
Hope I helped you
&
|
|
|
|
|
Hey Guys
Using Vb.net 2005,
I want to read each part in this string in an array (splitting the string)
-----------
A1/EXT "BK82 LB73 21233" 105 061018 1804
-----------
That Code that i used is as follow:
Dim s As String, h As String
Dim delim(1) As Char
delim(0) = "/"
delim(1) = " "
Dim f() As String
s = A1/EXT ""BK82 LB73 21233"" 105 061018 1804
f = s.Split(delim)
-----------
The problem that I m facing is as follow :
even what is inside the double quotes is devided into parts
what should i add to my code (or any other solution),
in order to keep what is inside the "" with splitting
Regards,
Ramy
|
|
|
|
|
You need to use a regex to follow more complex rules such as 'split on spaces not within quotes'.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Try this:
<br />
dim S2Split As string = "A1/EXT "BK82 LB73 21233" 105 061018 1804"<br />
dim delim(1) as char<br />
delim(0)="/"<br />
delim(1)=" "<br />
dim f(0) as string<br />
dim I as integer<br />
dim J as short<br />
dim Tmp as string=""<br />
dim Ad as boolean<br />
dim fPos as integer =0<br />
<br />
for i=0 to s2split.length-1<br />
Ad=true<br />
for j=0 to 1<br />
if s2split(i)=delim(j) then ad=false<br />
end for<br />
if ad=true then<br />
tmp=tmp & s2split(i)<br />
else<br />
f(fpos)=tmp<br />
tmp=""<br />
fpos += 1 'New feature in VB.NET 2005 ;)<br />
redim preserve f(fpos) 'preserve means that increasing f and saving the ' 'previous data<br />
end if<br />
end for<br />
|
|
|
|
|
Dear Reuven.
thx for your help
Just a Question?
Have you tried out this code?
coz when i was trying out ,i faced a problem with the foor loop-(Next)
that's why i couldnt compile this code
Regards
Ramy
|
|
|
|
|
My mistake, I replaced Next I and Next J with end for...
for i=0 to s2split.length-1
Ad=true
for j=0 to 1
if s2split(i)=delim(j) then ad=false
end for 'replace with Next J
if ad=true then
tmp=tmp & s2split(i)
else
f(fpos)=tmp
tmp=""
fpos += 1 'New feature in VB.NET 2005
redim preserve f(fpos) 'preserve means that increasing f and saving the ' 'previous data
end if
end for 'replace with Next I
Reuven
|
|
|
|
|
Dear Reuven
Well no more erros in the code ( thx for that)
but the thing is that ,how can i display the Data?each part alone?should add it to array ?
it will be helpfull if i get ur mail such as Msn email
or kindly add me : abouelrim@hotmail.com
Regards
Ramy
|
|
|
|
|
Hi
Following are the code to execute the report:
Public Sub LoadReport(ByVal rptPath As String, ByVal dTbl As DataTable)
Dim oRpt As New ReportDocument
oRpt.Load(rptPath)
oRpt.SetDataSource(dTbl)
crptviewer.ReportSource = oRpt
crptviewer.RefreshReport()
End Sub
Dim ofrmRptViewer As New frmReportViewer
ofrmRptViewer.MdiParent = MDIMain
ofrmRptViewer.LoadReport("D:\DMS Source Code\DMS\Reports\rptDistributors.rpt", ds.Tables(0))
ofrmRptViewer.Show()
I m trying to generate report but the following error is occuring:
DLL 'D:\DMS Source Code\DMS\bin\Debug\CrystalDecisions.CrystalReports.Engine.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
|
|
|
|
|
Hi,
I'd like to know how i can add some cool image effects to the image in the picturebox like bump, diffuse, colorise, solarise enz. Anyone has some ideas?
--Zaegra--
|
|
|
|
|
My image processing articles in C# will give you a good starting point.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Could you give me a link
--Zaegra--
|
|
|
|
|
|
Ok thanks
--Zaegra--
|
|
|
|
|
hi
i want to print the win form in vb.net 2005 which contain different control and grphics (lines , circle etc). please give me the sample code
thanks
Regards Shahzad
|
|
|
|
|
All you have to do is search for "print form" on MSDN and you'd come up with an example[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
First of all tx in advance for reading this post. I'm not a programmer at all, so I even don't know if I'm asking to do this in the wright coding language:
In essence this my project :
I have a .log file that I need to convert structuraly to make it
usefull in FileMaker.
- open the logfile
- In the .log file there is a character that needs to be replaced with
another, to be able to convert it more easely into colums.
- Delete colums the Second and Forth colum (in excel since the shift
places it is first B, than C)
- Then those colums needs to be transposed (rows becomes colums) in order to be able to import them into FileMaker.
- save the logfile
I can do this in Excel but I want to skip the use of Excel. I only like
to use FM because it is going to be a runtime application. My costumers
wont have a 'full version' of FM and may or may not have Excel.
running FM pro 8.5 on Win XP.
Kind regards and Tx in advance !!!!
___________________________________
Option Explicit
Sub ReplaceAndTranspose()
Dim FromChars As Variant
Dim ToChars As Variant
Dim iCtr As Long
FromChars = Array(Chr(28))
ToChars = Array(Chr(124))
If UBound(FromChars) <> UBound(ToChars) Then
MsgBox "design error--make from/to match"
Exit Sub
End If
For iCtr = LBound(FromChars) To UBound(FromChars)
ActiveSheet.Cells.replace What:=FromChars(iCtr), _
Replacement:=ToChars(iCtr), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Next iCtr
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True,
OtherChar _
:="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1),
Array(4, 1), Array(5, _
1)), TrailingMinusNumbers:=True
Cells.Select
Cells.EntireColumn.AutoFit
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Cells.Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1:B200").Select
Selection.Copy
Sheets.Add
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub
|
|
|
|
|
Hi
I need to execute an exe preapred by using vb.net. When i execute it on Windows 98, i faced the following error message " a required dll mscoree.dll is missing".
Please let me know can we execute an vb.net application in windows98, which don't have vb.net installed.
Thanks
Manish
|
|
|
|
|
You can't run a VB.NET program if you don't have the .NET Framework installed on your computer. You can try creating a program in VB 6, that runs in Windows 98 and in XP, but that means you'll have to convert your project to VB 6 (if possible) or to start all over again, or maybe check Google for some other solutions?
--Zaegra--
|
|
|
|