|
amaneet wrote: dim d as datagrid
d = c
the type of c and d is not the same so you must use type casting to convert c to DataGrid
try this
d=(DataGrid)c
Mohamad A. Flefel
mflefel@hotmail.com
+962 79 5963865
C#.net & VB.net Developer
|
|
|
|
|
I have wrote timer routine in Visual basic Editor in Ms Excel2003 in which the timer will update the values of the cells of procedure opcavgtemp automatically after each 2 minutes .
Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "OPCAvgtemp"
sub opcavgtemp()
'code to be executed every 2 min
StartTimer
end sub
sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
schedule:=True
End Sub
The problem is when Itry to migrate this macro code to VB 6.0 it show for me error , object required.
Could anyone help me please urgent ??
|
|
|
|
|
alhomed44 wrote: Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
schedule:=True
In VB6 you have NOT an Application object hence it complains about.
You can use a Timer control to obtain that stuff.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
how to add textbox to datagrid in winforms and display the value in it
|
|
|
|
|
Your question is somewhat vague. Would you care to elaborate?
Posted by The ANZAC
|
|
|
|
|
how to add textbox to the datagrid
|
|
|
|
|
By using datagrid view property,
Go to columns property and select what type of columns you want ie., u can add textbox,checkbox,button columns etc.
Janani
|
|
|
|
|
i have a question for this .. how can i retrieve a specific textbox but? because there would be for example about 5 rows with textboxes. how can i take control of the for example the second row textbox?
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
I am a newbie to vb.Net, I am self taught to a basic level on MSAccess. What i am trying to do is create an MDI application. Part of the application is to open a form with no data assigned to the controls, then open a form to set the query and return this result to the main form as the data. I m getting confused with datasets, tableadpators etc. Can someone point me in the right direction please. Also i want the filter form to be the topmost and hold the focus until a filter has been submitted or a cancel button clicked.
Confused newbie
|
|
|
|
|
http://msdn.microsoft.com/vstudio/express/vb/learning/default.aspx
Try this, should get you started on vb.net, if you want to go straight to database and skip the basics, i recommend episodes 8 and 9 of the beginner series. If you are new to vb.net though, it might be good to do the lot, they are great for learning.
Posted by The ANZAC
|
|
|
|
|
Thankyou for the reply i will certainly look through these. I have been using a book from the library by 'WROX' to get me started. It explains datagrid views, and in general i understand the concept of binding the form to a table through using Access, but I am getting confused with the passing of a dataset back to a form. Is it as simple as Open form 1 with databind to the empty dataset. Open form 2 (filter/query form), on click handle event use parameters to fill dataset. return focus to form 1 and fill with bind to dataset which has info in it now/or not dependant on parameters.
Am i barking up the wrong tree? and is there an easy example of this i can view for guidance?
With regards to the filter form remaining on top, I have set this form to property ON TOP and I am using the If form.focused = false then form.focus() to keep the form active/focused and the topmost. This is primitive i know and it is not working on all occasions though, any pointers appreciated.
|
|
|
|
|
I am trying to bring up an Excel sheet when I click on a command button in Access. Can someone help me with the code?
PS I am very green at programming VBA.
Thank you,
Jake Wagner
|
|
|
|
|
You have not sid if you want it on a form in Access or to bring it up in another window.
I am not sure if you can do this in VBA, but in VB6 to load the spreadsheet into a form you place it in an OLE Container.
To bring Excel up in a seperate window you could try using the excel object by setting a reference in access to the excel.olb
David Loring
!! Keep Music Live !!
|
|
|
|
|
Is there a way to reference microsoft access programatically?
|
|
|
|
|
|
You could add a reference to the MS Access library and declare the MS Access application as an object variable in your code.
|
|
|
|
|
What is it that you want to do? Can't you do it using a database connection?
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
I'm trying to transfer text files into Microsoft Access for data importing/exporting. Also copy table objects if they do not exist and run simple sql statements against Access tables. Here is the code...
Function ImportTXTFileIntoAccess(ByVal MyImpTableName$, ByVal MyTxtFileFolderPath$, ByVal MyTxtFileName$, ByVal MySpecialCase$, ByVal ForFutureUse2$, ByVal ForFutureUse3$)
On Error GoTo MyErrorControl
' FUNCTION EXPECTS:
' 1) CSV or TXT file with FIELD HEADERS in first line
' 2) CSV must contains only ONE record (one patient)
' 3) CSV must be named using the following format:
' PatientMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV
' SpouseMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV and so ON
' Note: Unique identifier between tables are normally set using DATE_TIME STAMP at time of creation
Select Case UCase(MySpecialCase)
Case "CLEAR TEMP TABLES IN ACCESS", "EMPTY TABLES", "EMPTY TEMP TABLES", "CLEAR TEMP TABLES", "CLEAR TEMP TABLES ONLY", "INITIALIZE TEMPORARY TABLES", "INITIALIZE TEMPORARY TABLES ONLY"
TryToEmptyTablesAgain:
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_PatientMWPAT_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_SpouseMWPAT_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_CaseMWCAS_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_AddressMWADD_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_AddressSpouseMWADD_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_PrimaryInsuranceMWINS_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_SecondaryInsuranceMWINS_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_ResponsiblePartyMWPAT_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [MyStatus]")
Exit Function
Case "IMPORT TXT FILE", "IMPORT TXT FILES", "IMPORT FILES", "IMPORT", "PROCESS FILES", "PROCESS CSV"
If File.Exists(MyTxtFileName) Then
' Import one patient than update Link field so we can later match up the patient with spouse, guantor, insurance, case
Dim MyLinkID As String
' Find where the first _ (underscore pos is)
Dim myPos As Integer
myPos = InStr(MyTxtFileName, "_")
If myPos > 0 Then
MyLinkID = Mid(MyTxtFileName, (myPos + 1), 250) ' 250 max file name legth
Dim MySQL = "UPDATE " & MyImpTableName & " SET " & MyImpTableName & ".[MyLinkID] = '" & MyLinkID & "' WHERE ([MyLinkID] Is Null)"
AccessTmpDB.DoCmd.TransferText(0, MyImpTableName, MyImpTableName, MyTxtFileName, True, "")
AccessTmpDB.DoCmd.RunSQL(MySQL)
Else
MsgBox("Sorry, CSV or TXT NAME convention DOES NOT MEET REQUIREMENTS. Name format MUST BE as follows:" & Chr(13) & Chr(13) & " PatientMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV" & Chr(13) & " SpouseMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV and so ON" & Chr(13) & "UNABLE TO CONTINUE")
Exit Function
End If
Else
MsgBox("File to be imported DOES NOT exist: " & MyTxtFileName)
Exit Function
End If
Case Else
MsgBox("Sorry, option not implemented: " & MySpecialCase)
Exit Function
End Select
GoTo ExitFunction
TableDoesNotExist:
' Create table using MASTER table
AccessTmpDB.DoCmd.CopyObject(, "IMP_PatientMWPAT_Spec", Access.AcObjectType.acTable, "IMP_PatientMWPAT_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_SpouseMWPAT_Spec", Access.AcObjectType.acTable, "IMP_SpouseMWPAT_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_CaseMWCAS_Spec", Access.AcObjectType.acTable, "IMP_CaseMWCAS_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_AddressMWADD_Spec", Access.AcObjectType.acTable, "IMP_AddressMWADD_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_AddressSpouseMWADD_Spec", Access.AcObjectType.acTable, "IMP_AddressSpouseMWADD_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_PrimaryInsuranceMWINS_Spec", Access.AcObjectType.acTable, "IMP_PrimaryInsuranceMWINS_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_SecondaryInsuranceMWINS_Spec", Access.AcObjectType.acTable, "IMP_SecondaryInsuranceMWINS_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_ResponsiblePartyMWPAT_Spec", Access.AcObjectType.acTable, "IMP_ResponsiblePartyMWPAT_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "MyStatusMASTER", Access.AcObjectType.acTable, "MyStatusMASTER")
' Clear temp tables again
GoTo TryToEmptyTablesAgain
ExitFunction:
Exit Function
MyErrorControl:
Select Case Err.Number
Case 0
Exit Function
Case 3078
Resume TableDoesNotExist ' Create tables
Case Else
Call iDisplayErrorMessage(Err.Number, Err.Description, "ImportTXTFileIntoAccess", vbOKOnly)
Exit Function
End Select
End Function
|
|
|
|
|
I'm porting C# code to VB .NET and I'm having trouble converting the following C# structure to VB .NET? I'm having problems with ArraySubType.
public struct FrameInfo
{
...
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65536, ArraySubType = UnmanagedType.U1)]
public byte[] Frame;
}
Thanks
VF
|
|
|
|
|
Hello everybody,
I'm new to VB.NET and I'm just wondering what is the correct method to populate a combo box in order for the user to see a value (like a caption) and behind the scene to get a value.
Something like :
("caption1",val1)
("caption2",val2)
I'm asking this because I have to run from vb.net an Oracle package and pass the parameters (va1 or val2 etc) based on what the user is selecting from combo box.
I apologize in advanced if this issue was already discussed.
Thank you,
|
|
|
|
|
Even if it was discussed, if you can't see it, then it's worth discussing again )
If you have a combo box called cb, then cb.Items.Add is the way to add an item, I can't recall if you need to construct an item there, or just pass two values.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you for your answer.
I managed to solve the problem creating a new class and using the DataSource,Displaymember and Valuemember properties of the combobox control.
|
|
|
|
|
Hi!
Im working with VS2003 — VB.Net. I stuck with problem. When i apply serialization for my class, i cant get element with 2 attrib: one attribute as null (xsi:nil="true") and another - valuable.
Like this : <IndTaxNum ROWNUM="1" xsi:nil="true" />
My code:
' piece of class for serialization
Public Class DBody
' .....................
<System.Xml.Serialization.XmlElementAttribute("IndTaxNum", _
Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, _
IsNullable:=True)> _
Public IndTaxNum() As IndTaxNumColumn
'.....................
End Class
' type IndTaxNumColumn declare
Public Class IndTaxNumColumn
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public ROWNUM As Integer
<System.Xml.Serialization.XmlTextAttribute()> _
Public Value As String
End Class
XML document use for saving table. Not all variables Value have meaning (some of their Nullable).
<IndTaxNum ROWNUM="1" xsi:nil="true" />
<IndTaxNum ROWNUM="2">345453<IndTaxNum/>
<IndTaxNum ROWNUM="3" xsi:nil="true" />
<IndTaxNum ROWNUM="4">767567<IndTaxNum/>
.................
However if set in code:
Value = System.DBNull.Value.ToString or
Value = Nothing or
Value = String.Empty
generating —
<IndTaxNum ROWNUM="1" />
if dont insert value to array IndTaxNumColumn -
<IndTaxNum xsi:nil="true" />
So, what i must set for that result:
<IndTaxNum ROWNUM="1" xsi:nil="true" /> ?
thank you!
|
|
|
|
|
hi dudes,
Please help me how to create a user control calendar display.
I am not able to understand the logic how to create
Thanks in advance.
-- modified at 7:26 Monday 11th December, 2006
Success is 99% failure
|
|
|
|
|
Look at some CP articles for user controls to see the approach to take.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|