Working With BitBit
Hi,
I've just began using BitBit now, so i'm not too good, i'm progressing slightly, but have a small problem...
Anyway, i've began making a square grid based maze game to get used to the functions of BitBit and cant seem to get something right, the game currently in no way resembles a maze, because I haven't started that bit yet...
To move the sprite properly, on a square-based grid i have set up an intXNow value to work with the intX, so that the character only moves so far at a time, by presetting intX to 10, then everytime you press to move, intXNow updates itself to equal intX, then runs the movement part on a timer...
Code: Do Until intX >= intXNow + 50
-- movement code --
Loop
This works fine, but when you run it the first time he moves, he does four steps, the next time he does 5 steps, so he is no longer in the center of the x-axis grid...
I'm not sure what I have done wrong with this code.
Can somebody please look at my source code and tell me what i have done wrong to cause this uneven movement.
The source is in the zip below...
Your Help Is Greatly Appreciated.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Help With BitBit
Hello,
I am new to the gaming scene. I have picked up a little here and though however. I was wonder how to determine the size of the map window? Uhh...How to make it Show more of the map? The example I am looking at only has a small block, but I want to increase it to view more map at a time. Any suggestions on where to start?
Bitbit Help
hey i am making a character moving using bitblt to bit the character into a picture box
how to i make it so when i move the picture it will not leave the previous picture behind. so it will look like that character is moving.
thanks
BitBit Help
first off, what is Bit Bit, and how do you use it, can someone give me a good place to learn it from, tutorials or something, thanks in advance
Just Cant Understand BitBit!
Ok, ive tryed to understand this stuff for about 4 hours by now. And i just dont GET IT! I get NO ERRORS at all, but NOTHING HAPPENS either. So i wondered if anyone would post a newbie BitBit program for me.
thx
BitBit Error
When i try to initialize BitBit i get this error:
Help????
BitBit With MSChart
Can you use BitBit to make a realtime MSChart Graph not flicker? I've looked through some of the threads here and they seem to mainly use pictureboxes for gaming. Is the principle the same, if so how would i implemet it?
Thanks
Sean
DLLImport - GDI32.dll - BitBit -
hi,
the Issue is ,
I would like to crop part of image. (I know the rectangle to be cropped from the tiff image). I tried DrawImage. But some Pixel Information is lost.
So I am trying to use BitBit approach.
My Code is ::::::
---------------Declaration - ----------------------
<DllImport("gdi32.dll", EntryPoint:="BitBlt", SetLastError:=True, _
CharSet:=CharSet.Unicode, ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function BitBlt( _
ByVal hdcDest As IntPtr, _
ByVal nXDest As Integer, _
ByVal nYDest As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hdcSrc As IntPtr, _
ByVal nXSrc As Integer, _
ByVal nYSrc As Integer, _
ByVal dwRop As Int32)
End Function
Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
-----------------------
My function for cropping is
----------------------------
Dim g1 As Graphics = PictureBox1.CreateGraphics()
Dim imgCrop As New Bitmap(200, 200)
Dim g2 As Graphics = Graphics.FromImage(imgCrop)
Dim dc1 As IntPtr = g1.GetHdc()
Dim dc2 As IntPtr = g2.GetHdc()
BitBlt(dc2, 0, 0, 200, 200, dc1, 100, 200, SRCCOPY)
g1.ReleaseHdc(dc1)
g2.ReleaseHdc(dc2)
imgCrop.Save("c:Captured.jpg", ImageFormat.Jpeg)
MsgBox("Finished Saving Image")
------------
Error Msg :::
Unhandled Exception
PInvoke restriction: cannot return variants.
Anyone has idea about where I am doing wrong. Or any better approach for this
Transparency, BitBit() And Number Sorting
1. Transparency
Will a gif with a transparent background still have a transparent background on a form? If not then how can i get transparent backgrounds?
2. BitBit()
Unless it is very complicated and hard to explain could you show how to use BitBit() for animation?
3. number sorting
i have this code:
VB Code:
Dim dblAns As String Dim intDig As IntegerDim dbl As StringdblAns = "2856457889" For intNum = 1 To Len(dblAns) intDig = Mid(dblAns, intNum, 1) If (intDig Mod 2) = 0 Then If Len(dbl) Then dbl = dbl & ", " & Format(intDig) Else dbl = Format(intDig) End If Else dbl = dbl & Format(intDig) End IfNext intNum MsgBox "The numbers are:" & dbl
it splits the number 2856457889 into 2, 85, 6, 457, 8, 89
even numbers start a new number
rather than putting the split numbers into a string and displaying it in a msgbox i want it to load a new txtbox eg. txtNum fo each number.
thnx 4 help and i hope this post is more successful than last time
Make Bitmap Transparent With BitBit
Hi all -
Lets say I have a bitmap with a region that has been marked with a certain color to detone a transparent area - how could I go about BitBit'ing on top of another picture in VB so that the solid color becomes transparent? THanks
-Chris
Hmmm....bitbit Seems Easier Than Trying To Do Maps With An Editor?
Hello again,
I got my map working with bitbit, but the things are super small. I can barely see em hehe, anyone got a site that will show the break down of bitbit that what represents what? I had to just play with some and just do a row of numbers and see what I came out with. The last question is, to increase the actual size my bits display at do I need to increase the pixel size?
Thx for any help.
Questions: BitBit Moving, Walkmasks And Item Pickups.
Ok, so far have i quickly created a small program where a picture(the guy you control) moves instantly to the location of your click. Theres 3 things i must now:
1. How can i make my guy move slowly to the targeted location? not instantly.
2.How can i create walkmasks? Forexample if i create a tree, and i dont want my guy to walk right through the tree but around it.
3.How can i make my character pick up items? Forexample how can i make my guy get 10 score-points when he moves over an item, which in reality is a picture.
Edit*
I use BitBit.
This is not going to be a real game, iam just testing things out before i start creating a game.
Nothing is animated.
Wave Files And Vista. Some Working And Some Not Working. Strange.
Hello everybody,
I have an application with embedded in the ressource file wave files. I use PlaySound to play them. This works perfectly up to Windows Xp.
Recently I have a friend testing the application on Vista. Certain files are not playing, and others are.
Any ideas why some would play and some wouldn't? It seems very strange.
Here is the code. It works for some wave files and not others
VB Code:
Call PlaySound("MY_EMBEDDED_WAVE_FILE", App.hInstance, SND_RESOURCE Or SND_NOWAIT Or SND_NODEFAULT Or SND_ASYNC)
Application Working On Office 97 But Not Working On Office2000 !
Hi everybody,
I use an application based on Excel working initially on office 97 developped by a workmate few years ago and now not working on office 2000. Here is the error raised and the part of code responsible for that :
=> EXECUTION ERROR : "1004"
Toolbars.Add Name:="Tableau de Bord"
Toolbars("Tableau de Bord").Visible = True
With Application
.ShowToolTips = True
.LargeButtons = False
.ColorButtons = True
End With
Toolbars("Tableau de Bord").ToolbarButtons.Add Button:=126, before:=1
Toolbars("Tableau de Bord").ToolbarButtons(1).OnAction = "AppelProcedure"
(here is the mistake !!!!) Toolbars("Tableau de Bord").ToolbarButtons.Add Button:=243, before:=2
Toolbars("Tableau de Bord").ToolbarButtons(2).OnAction = "AppelProcedure"
Toolbars("Tableau de Bord").ToolbarButtons.Add Button:=42, before:=3
Toolbars("Tableau de Bord").ToolbarButtons(3).OnAction = "AppelProcedure"
Toolbars("Tableau de Bord").Width = 1527
If someone has an idea ?
Thank you,by advance....
Program Was Working, Now Not Working Runtime Erros
I have a program that searches through a recordset for indexes to lines in an order.
The program worked fine until the owner re-indexed or rebuilt all the indexes. Basically all the pointers changed for these lines, and now my program is freakin out and saying it cant find data.
Heres the code that previously worked, and STILL works on some orders.
vb
Private Sub Command1_Click()
Set rstMyrecset = Nothing
Set Mas90 = Nothing
Do Until strNextline = 0
If Ordernumber <> strSalesorder Then
MsgBox Err.Source & "The order number has changed." & _
"This order is crosslinked." & Err.Description, , "Error"
GoTo error:
End If
cmdMyrecset.CommandText = "SELECT LineIndex, LinkToNextLine," & _
" SalesOrderNumber, LinkToPrevLine FROM SO2_SOEntryDetailLine WHERE" & _
"(LineIndex LIKE '%" & strNextline & "')"
Set rstMyrecset = cmdMyrecset.Execute
strLineindex = rstMyrecset.Fields.Item("LineIndex").Value
strPrevline = rstMyrecset.Fields.Item("LinkToPrevLine").Value
strNextline = rstMyrecset.Fields.Item("LinkToNextLine").Value
strSalesorder = rstMyrecset.Fields.Item("SalesOrderNumber").Value
txtLineindex.Text = strLineindex
txtPrevline.Text = strPrevline
txtNextline.Text = strNextline
txtOrdernumber.Text = strSalesorder
txtLineindex.Refresh
txtPrevline.Refresh
txtNextline.Refresh
txtOrdernumber.Refresh
'Sleep 1000
'DoEvents
'Open "c:windowsdesktopmylog.txt" For Append As #1
'Print #1, "Previous Line "; strPrevline, "Next Line "; strNextline, "Line Index "; strLineindex
'Close #1
Loop
MsgBox "The order started at 00 and ended in 00, and the order number did " & _
"not change. Pre-checking can be notified this order is OK."
error:
txtLineindex.Text = 0
txtPrevline.Text = 0
txtNextline.Text = 0
txtOrdernumber.Text = ""
txt02pointer.Text = 0
quit:
End Sub
/vb
I believe the offending code is the SELECT statement. The select statement gets the lines, and checks the order, to make sure no lines are crosslinked into another order. On some orders, it works fine, but others, where the lines are low numbers such as 1, 2, or 3, the program bombs, with a FILE i/o error: data not found.
Msdaora.1 Working But OraOLEDB.Oracle Not Working
I'm connecting to Oracle server with this code:
Dim db As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String
str = "Provider=MSDAORA.1;User ID=*****;Data Source=***;"
db.CursorLocation = adUseClient
db.Open str
it's successfully connected to database... but to pass parameter to a stored procedure with ref cursor I need to use oraOLEDB.Oracle provider. when I'm typing :
str = "Provider=oraOLEDB.Oracle;User ID=*****;Data Source=***;PLSQLRSet=True;"
It's giving me an automation error..
Provider cannot be found. It may not be properly installed. error no. 3706
I don't know what to do.. I don't know why is that error. Could anybdoy Please help me how could i install oraOLEDB.Oracle provider.
Thanks
Mehedi
Working In Excel While VB Is Working -- RESOLVED
Hi
I have an application which creates a large Spreadsheet, it takes about 20 minutes all in.
This is not the problem.
The problem is while the Ssheet is being created the user cannot work on the
N other spreadsheets they have on the go.
I have used .visible = false, but to no avail.
Help, how do I keep the application from being shown/messed by a hyperactive user while it is being created.
Thanks
Simon
Component Not Working In Windows 2003 Server But Working In Windows 2000 Server
hi,
I have a VB upload component which woeks weel with the Windows 2000 server but when i have the same component installed in the Windows 2003 server it is not working. It is displaying the following error. error '800706be' . Searching the microsoft support site i cannot get any relevant information. If anyone has solution for this.
Bye
Sridharan
Gif No Working?
a beginner want to ask a simple question, how can i use gif in my vb windows? i know gif is not the defaulf kind to be recognised by VB6, is there any easy way which enables me to use it now?
Gif's Not Working
When I insert a gif into an image or picture box then run the program, the gif doesn't work. I looked in the properties window and it says that the gif is a bitmap. I loaded a jpg later and it still said it was bitmap. How can I fix it? I'm running Visual Basic 6.0 Learning Edition. PLEASE HELP!!!
Working With MSN
I am looking for any code/tutorials or anything at all Visual Basic which allwos me to send messages, change picture etc. Everything is appreciated
Thanks
How To Get ICQ Working In My App?
hi,
I´ve been searching for a while now and have found no way to to connect to the icq-service. I don´t wan´t to do anything fancy, just connect/disconnect, get online-user-list, and send and receive simple textmessages.
I´ve downloaded the icqapi, and hav lot´s of source that should work with it (even found some here) but nothing worked.
Is there any other way I could do it.
Somebody know a working control that I could use?
I would appreciate any advice you might have
Not Working
i am tring to use this to email a person and no errors come up but the email never gets out, i checked my outlook and sent a email with it and it worked fine.
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipAddress = "james@jbsoftwarz.com"
MAPIMessages1.RecipDisplayName = "james"
MAPIMessages1.MsgSubject = ""
smessage = "Test body message"
MAPIMessages1.MsgNoteText = smessage
MAPIMessages1.Send False
MAPISession1.SignOff
Why Isn't It Working?
hey pals!
when my friend tried to connect to my server he didn't succeed to establish a connection.
does anybody know why it does so?
i am using WinXP and have ADSL and LAN on my computer.
the source code :
SERVER
Code:
Code:
Private Sub Form_Load()
Winsock1.LocalPort = 1221
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
CLIENT
Code:
Code:
Private Sub Command1_Click()
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Text2.Text
Winsock1.Connect
End Sub
Private Sub Winsock1_Connect()
MsgBox "Connected!!!"
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer,
Description As String, ByVal Scode As Long,
ByVal Source As String,
ByVal HelpFile As String,
ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "Error: couldn't connect!"
End Sub
Not Working?
i have narrowed down the problem in my code to this one section
Code:
ddsd4.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
ddsd4.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
ddsd4.lWidth = 384
ddsd4.lHeight = 32
Set Tilesurf = dd.CreateSurfaceFromFile(App.Path & " extures" & Tileset, ddsd4)
now the only thing that messes up is the last line and i cant figure out why, thank you for any help u can offer.
Working With Ie
hi
I need to open a new IE go to this site ://www.bloomberg.com/markets/index.html
and copy the currency table to a new worksheet in the work book that i run the sub from.
So far all I can do Is open IE and get it to the site. I have no idea how to get the data into the workbook.
Help please!!!!!!!!
Not Working With 98
Hi all,
I am totally new to vb. Now making small applications to learn with. All going pretty good with books etc. I just have a small question, if I make an executable file, it does not run under Windows 98 saying that some dll file is missing. I was thinking that a stand alone exe file won't requires something to get installed on the target system. So how can I make the file compatible with other OS. and I made a small app that reads from a text file and displays the lines in a text box. works fine on the system where I wrote it, but if I copy it to another XP system, it says ISAMS not found, I know for that I need drivers but is there any way that I can compile the application so that it takes all what it needs along with it and get no problems if executed at another system.
All help would be greatly appreciated
Thanks
Why Is It Not Working.....?
Hey everyone. I was here recently talking about how in my programmign class in high schol we were giving a visual basic project to do yet have not actually read too much on visual basic and left to "learn it on our own" and present the project later. Well, I actually got some code up but don't understand why it is not working
The problem was:
Two numbers are said to be 'amicable' if they are different and the sum of the divisors of each number (including 1 but excluding the number itself) equals the other number.
For example: 2620 is divisible by 1, 2, 4, 5, 10, 20, 131, 262, 524, 655 and 1310; these add up to 2924. 2924 is divisible by 1, 2, 4, 17, 34, 43, 68, 86, 172, 731 and 1462; these add up to 2620. Therefore 2620 and 2924 are amicable.
Write a program which inputs two numbers (which will be less than 10,000) and then prints "Amicable" if they are amicable, or "Not amicable".
This is my code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim factor1 As Integer
factor1 = Val(inputa.Text)
Dim totalfactora As Integer
totalfactora = 0
Dim counter As Integer
counter = factor1 - 1
Do While counter > 0
If counter Mod factor1 = 0 Then
totalfactora = totalfactora + counter
End If
counter = counter - 1
Loop
Dim factor2 As Integer
factor2 = Val(inputb.Text)
Dim totalfactorb As Integer
totalfactorb = 0
Dim counter2 As Integer
counter2 = factor2 - 1
Do While counter2 > 0
If counter2 Mod factor2 = 0 Then
totalfactorb = totalfactorb + counter2
End If
counter2 = counter2 - 1
Loop
If totalfactora = totalfactorb Then
answer.Text = "they are amicable"
End If
End Sub
Every aspect of the code works individually so I assume its my loop. Is it worded wrong or anything? Ok let me explain the variables:
factor1 is an integer that takes the number from the text(had to use the VAl function like somehow said earlier). totalfactora should be the sum of all of the factors of the factor1 number. Currently its at 0. Then the counter variable will be subtracted 1 each so every number except itself is checked as a factor.
I worded the Do while loop so it would continue runnign as long as counter would stay above 1. Then inserted an if statment to check if the current counter number was a factor and if so, then it would be added to the totalfactors. if not, it wouldn't do anything. At the end of the loop, counter is subtracted 1 and then the process is repeated. Theoretically, I believe it should work heh, but when I tried the loop totalfactora stays 0. Basically the code after it with totalfactorb, coutner2, is just a mirror.
Hope you got what I was trying to say heh. Appreciate any help
blkhatpersian
I Just Don't See Why This Isn't Working...
Ok, this is for my gr. 10 computer science class. It's a lot simpler than a lot of the stuff I've seen around here (kind of intimidated), but hey, I have to start somewhere right?
Anyways, this is my problem. I'm making an application that's supposed to take popcorn orders. It has check boxes for different flavours. They work when I click it (it adds the extra price to the total "flavours" price), but then when I uncheck the box, it doesn't subtract the price again. Any help?
Code:
Private Sub chkButter_Click()
'Add flavours price
If chkButter.Value = vbChecked Then
flavours = flavours + butter
Else
flavours = flavours - butter
End If
'Display total
total = total + flavours
lblTotal.Caption = total
End Sub
Why Is This Not Working :/
Can anyone tell me how i can get this to work?
What im trying to do is this ordering thing for a hotel (its homework )
Here is my layout.
http://img.photobucket.com/albums/v5...kin/error2.jpg
Now what i want it to do is add the caption of the checkbox's and option buttons to the text box when the boxes are checked. but for some reason its not letting me do it :/ i click the box and nothing happens.
This is the code,
Quote:
Private Sub chk_sky_Click()
If chk_sky.Value = True Then
txt_bill.Text = chk_sky.Caption
End if
End Sub
.next Not Working
ive used it before and its worked but for some reason im having problems with it now.
dim curcell as range
set curcell = curcell.next
should set curcell to the cell one column left of curcell. right?
well im just getting the original curcell
please help
TLI Not Working
Can anyone tell me why this code isn't working in compiled mode?
Code:
Dim TLIApp As New TLIApplication
Public Sub EnumMethods(ListBox As ListBox, lpObject As Object)
Dim ClassInfo As Object, Tell As Long, InvKind As Long
' Get interface information about the object
Set ClassInfo = TLIApp.InterfaceInfoFromObject(lpObject)
' Clear all data
ListBox.Clear
For Tell = 1 To ClassInfo.Members.Count
InvKind = ClassInfo.Members(Tell).InvokeKind
If Not (InvKind = INVOKE_PROPERTYPUT Or InvKind = INVOKE_PROPERTYPUTREF) Then
ListBox.AddItem ClassInfo.Members(Tell).Name
End If
Next
End Sub
Private Sub Form_Load()
EnumMethods lstMethods, Me
End Sub
I've added "TypeLib Information" from references, but I still get error 445 when I have compiled it. Some suggestions how I can fix it
.exe Not Working
I made a game, and I went to make it into a .exe file and when I went to run it the dos screen appears then just disappears...anyone know why this is happening or how we can fix it???
Working Out A Sum
I was wondering if i had a textbox with a sum it and i wanted to work out the answer and display it in another text box how would i do it??
Help, Not Working!!
Hello, i have a form with among other things a tabstrip. The tab strip has 3 tabs. The first tab is labeled NOTES. It has a text box below i want to use for a todo/reminder type thing. I want this to be the default tab and text when everything loads up, so i want the todo there everytime you start up. The 2nd tab is called JEFF. It has a label with it that i want to show up when i click on 2nd tab. Same with the third tab. All three, 1 text box, 2 labels are all on top of each other, i want to show the cooresponding one with each click of the tabs. For some reason i just cannot get this right. Below is copy of my code. Im a newb so be patient with my setup please. The basics are here but ive kinda destroyed some code messing with it. I tried a few differnt things including using a select case routine but nothing. Thanks alot up front for any advise.
(at the bottom)
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
Private Sub cmdexit_Click()
End
End Sub
Private Sub Form_Load()
Dim hSysMenu As Long, nCnt As Long
' Get handle to our form's system menu
' (Restore, Maximize, Move, close etc.)
hSysMenu = GetSystemMenu(Me.hwnd, False)
If hSysMenu Then
' Get System menu's menu count
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
' Menu count is based on 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE ' Remove the seperator
DrawMenuBar Me.hwnd
' Force caption bar's refresh. Disabling X button
End If
End If
End Sub
Private Sub cmdINTERNET_Click()
Shell ("c:/program files/myie2/myie.exe")
End Sub
Private Sub cmdMUSIC_Click()
frmdesktop.Hide
frmMUSIC.Show
End Sub
Private Sub cmdPICTURES_Click()
frmdesktop.Hide
FrmPICTURES.Show
End Sub
Private Sub cmdUTILITIES_Click()
frmdesktop.Hide
frmUTILITIES.Show
End Sub
Private Sub tabtodo_Click()
Select Case TABCHOICE
Case tabtodo.Tabs(1).Selected = True
Case tabtodo.Tabs(2).Selected = True
TextNOTES.Visible = False
LblJS.Visible = True
CmdCHOICE1.Enabled = True
CmdCHOICE1.Visible = True
CmdCHOICE2.Enabled = True
CmdCHOICE1.Visible = True
Case tabtodo.Tabs(3).Selected = True
CmdCHOICE1.Enabled = True
CmdCHOICE1.Visible = True
End Select
End Sub
Private Sub Timer1_Timer()
frmdesktop.Caption = Format(" The Time:" & " " & Time, "h:nn:ss am/pm") & " " & "The Date:" & " " & Format(Date, "m/d/yyyy")
End Sub
EOF Not Working?!!
Can somebody please tell me what I'm doing wrong here?
I'm still getting "Run-time error '62': Input past end of file" but I dont see what's wrong.
Thanks very much.
'-------------------------------------------------------------------------------------------
Public Function EOF(ByVal FileNumber As Integer) As Boolean
End Function
'-------------------------------------------------------------------------------------------
Private Sub Command1_Click()
Dim FileName As String
Dim X As Integer
FileName = "C:A.CGF"
Open FileName For Input As #1
Do While Not EOF(1)
Input #1, X
Debug.Print X
Loop
Close #1
End Sub
SQL Not Working With Win 95/98
I have the following in my program:
Set myDB = OpenDataBase (myDB)
mySQL = "SELECT * FROM tblMain WHERE
Project Like '*" & txtProject & "*'"
Set rscd = mydb.Openrecordset(mySQL)
mySQL = "AddDate LIKE '*" & Format$ListAddDates.Text,
"m/d/yyyy") & "*'"
rscd.FindFirst mySQL
If rscd.NoMatch = true then exit sub
Then I go into adding text into a form
Text1.text = rscd.fields("FirstName")
It works when I test it on XP and ME but when I test it on 95/98 it throws me out at the EXIT SUB.
Is there another way to say the same thing so it will work? I need to narrow the fields down twice. When I only need one field - it works fine even on 95/98.?? Any ideas?
Why Is It Not Working?
Hi there.
I cannot get this code to work, please help:
Dim x As Currency
Dim working As Currency
Dim dollarrate As Currency
Dim yenrate As Currency
Dim eurosrate As Currency
Dim commission As Currency
Dim total As Currency
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!DOLLARS!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!
'
'
'
'
'
'
'
'
'
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!DOLLARS!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!
If txtfirst.Text = "" Or txtlast.Text = "" Then
MsgBox "You have not entered your name"
End If
If mnuCurrencyDollars.Checked = True Then
'Else
mnuTransactionBuying.Checked = True
txttransaction.Text = "Buy"
fratransaction.Enabled = True
txtcurrency.Text = "Dollars"
lblenter.Caption = "Enter the amount of " & txtcurrency + " to " & txttransaction
If txtreceipt.Text = "" Then
MsgBox "Please enter the amount of " & txtcurrency + " to " & txttransaction
mnuTransactionBuying.Checked = False
Else
dollarrate = 1.3753
working = txtreceipt.Text / dollarrate
txtst.Text = "£" & Math.Round(CCur(working), 2)
commission = 2 / 100 * txtst.Text + txtst.Text
total = commission
txttotal.Text = "£" & Math.Round(CCur(total), 2)
End If
End If
If we take of the mnucurrencydollars.checked = true statement then everything works fine.
Currently, with this code, it is not doing anything at all.
Please help.
This part of the Sub will have 2 more "procedures" like this, but the currency's will be for Yen and Euros.
Please help.
Thanks
Working Out Age
i got a text box that get a date of birth put in it, what do i need to write so that the age is worked out,
Sub Not Working Right
i'm calling a sub from the Form_Load procedure, and the sub will begin to execute (Like 1 or 2 lines) and exit to the calling statement!! need help
Why This Not Working ?
Dear all
I am using a Crystal Report Formula name "@ReportDate" having this text Date(2001,07,01), and passing the correct date from the vb program to this formula as follows:
ReportFile.FormulaFields(3).Text = "Date(2001,06,01)"
When I run the report the formula takes the value stored in the report formula and what I am passing to the report formula has no effect.
Any idea how to solve this, or am I missing something ??
Many thanks in advance
TCP/IP Not Working?
Okay I have a client and a server.. how do I get them to communicate?
I can work on datahandling once I make a connection but I can't get them to connect. I have found several TCP/IP examples on the internet but no matter what I do mine won't work like them.
I found a tic tac game on the internet and I played it on my Lan to test. Then I tried to play a chess game on the netwrok and it won't work because it says "Address is not valid from local machine." So it seems that some TCP/IP apps are made for a lan while others are made for open internet.
Can anyone point me to a TCP/IP resource for this. I need my connection to be open internet but also be able to test it on my Lan...
Just so you know my setup, I have 3 computers on a router sharing the same IP. I thought this would be a problem (and it is), but how can this tic tac toe game work fine?
Still Not Working
Dim cust As CustRec
Dim hire As HireRec
Dim vidarray(3) As Integer
Dim i As Integer, j As Integer
Private Sub cmbSelect_Click()
Open "C:MyWorkVB6AssesmentCustomer.txt" For Input As #1
Do While Not EOF(1)
Input #1, cust.ID
Input #1, cust.sname
Input #1, cust.fname
Input #1, cust.add1
Input #1, cust.Add2
Input #1, cust.Town
Input #1, cust.post
Input #1, cust.Phone
Input #1, cust.hire
If cust.ID = cmbSelect.Text Then
'displays the selected customer
lblID.Caption = cust.ID
lblSname.Caption = cust.sname
lblFname.Caption = cust.fname
lblAdd1.Caption = cust.add1
lblAdd2.Caption = cust.Add2
lblTown.Caption = cust.Town
lblPost.Caption = cust.post
lblPhone.Caption = cust.Phone
lblHire.Caption = cust.hire
End If
Loop
Close #1
Open "C:MyWorkVB6Assesmenthire.txt" For Input As #1
Do While Not EOF(1)
Input #1, hire.book
Input #1, hire.cust_ID
Input #1, hire.video_ID
Input #1, hire.date
Input #1, hire.copy
If hire.cust_ID = lblID.Caption Then
vidarray(j) = hire.video_ID
End If
j = j + 1
Loop
Close #1
For i = 0 To j
lstVids.AddItem vidarray(j)
Next
End Sub
I still can not get the video ID displayed in the list box, it should go through all the hire records and if it comes accross a customer ID that is the same as the one selected in the combo box it will take the Video_ID and place it into an array. Once it has been trough them all it will display the array in the listbox. I'm not sure what is wrong with the code, adding to the array or displaying the array.
Any ideas?
Thanks Gaza
VB6 Not Working
The other day when I started my computer it said that the registry files had screwed up so it had reverted to a recent backup of them, since then I noticed that whenever I try to view a form in the visual basic project whilt editing it it generates an error and immeditaly closes, I can easily view the code but the second whihc I switch view it crashes. Since then I have tries installing, reinstalling it, installing it again, cleaning out registry of all visual basic traces and installing it again but still to no prevail. I have resorted to permananetly removing my vb6 application permanently. What is the problem with it???
Do While Not Working...
hi please check my code:
the do while isnt working...
i wanted to compare text1 and text2 with the field in my database (fld_start, and fld_end)
if the criteria in my search is satisfied..
my problem is, if the criteria is satisfied, text1 and text2 is compared only with the first record...
did i placed the do while in the right place?... thanks...
Code:
Dim start, fend, text, Txt As String
Adodc1.Recordset.Find "fld_room = '" + room + "'"
Adodc1.Recordset.Find " fld_day = '" + day + "'"
If Adodc1.Recordset.EOF Then
With Adodc1.Recordset
.AddNew
.Fields!fld_start = Text1
.Fields!fld_end = Text2
.Fields!fld_room = room
.Fields!fld_day = day
.Update
End With
MsgBox ("New Schedule Saved!")
Else
Do While Not Adodc1.Recordset.EOF
start = FormatDateTime(Adodc1.Recordset.Fields!fld_start, vbShortTime)
fend = FormatDateTime(Adodc1.Recordset.Fields!fld_end, vbShortTime)
text = FormatDateTime(Text1.text, vbShortTime)
Txt = FormatDateTime(Text2.text, vbShortTime)
'If text > start And Text2 > fend Then
'MsgBox (" Conflict")
If text > start And Text2 < fend Then
MsgBox ("conflict")
ElseIf text < start And Text2 > start Then
MsgBox ("CONFLICT")
ElseIf text = start And Text2 = fend Then
MsgBox ("CoNfLiCt")
Else
With Adodc1.Recordset
.AddNew
.Fields!fld_start = Text1
.Fields!fld_end = Text2
.Fields!fld_room = room
.Fields!fld_day = day
.Update
End With
MsgBox ("New Schedule Saved!")
End If
End If
Loop
End Sub
Help! Exe Ist Not Working
Hi,
I've a strange problem: I've written a little system monitor where I can check the status of prozesses running on a remote computer. As long as I run it within "Visual Studio", everything works fine. When I compile the source to a exe and run that program, suddenly parts are no longer working. I need to make a connection to the romote pc by using the "OpenSCManager" API and exactly that function is no longer working:
Code:
hSManager = OpenSCManager(ComputerName, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS)
Any idea what is going wrong here?
Roj
Why Is This Not Working
Code:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim DbasePath As String
Dim sql As String
DbasePath = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & App.Path & "/movieguide.MDB"
Set cn = New ADODB.Connection
cn.Open DbasePath
Set rs = New ADODB.Recordset
sql = "DELETE FROM tblActor " & _
"WHERE tblActor.MovieID = " & lblCounter2.Caption & _
"AND tblActor.actor_ID = " & lblCntr3.Caption
Working With
Hello!
I am using MSHFlexGrid with 4 columns.
When user double-clicks on certein cell (1 to 4), i wan to display in MSGBOX the value that in the first column of that row.
Thanks in advance
Add New Not Working
Can anyone explain to me why this is not working please, im using an SQL Server express database and get the error method add new failed
thanks
Gibbo
Code:
Set rs = New Recordset
rs.Open "Select * from Tbl_Actions", cn
With rs
.AddNew
.Fields("Action_Too") = "Test" & ""
.Fields("Complete") = "Test" & ""
.Fields("Action_Time") = "Test" & ""
.Fields("Action_Date") = "Test" & ""
.Fields("Result_Time") = "Test" & ""
.Fields("Result_Date") = "Test" & ""
.Fields("Priority") = "Test" & ""
.Fields("X_Ref") = "Test" & ""
rs.Update
End With
but this does
cn.Execute ("INSERT INTO Tbl_Actions" & _
"(Action_Too) VALUES('This is a test')")
|