|
pravinkgarg wrote: I am facing the following problem while reading from a file.
Read the error message again - it tells you what the problem is...
pravinkgarg wrote: FileOpen(filenum, myfilename, OpenMode.Input)
Hint: Have you assigned correct and valid values to filenum and myfilename ?
Get a free file number by using FreeFile() .
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
hi steve,
The same code is working without any Bad FileName or number error, provided i have to run the code without placing any breakpoint for that respective line.What may be the reason i am wondering about it.
ya i gave freefile() before fileOpen in my earlier code.
regards,
Praveen.
|
|
|
|
|
Hi, I am Visual Basic beginner needing help desperately.
I am using Microsoft Visual Studio.Net 2003. I have a basic Form with 3 Labels and 1 Button.
I also have a Database with 3 Fields.
I want the Text from Label1, Label2 and Label 3 to be stored in the database when Button 1 is clicked.
Please can someone help me to do this, with sample code, including the database connection.
Thanks
ensuvari
Regards
ensuvari
|
|
|
|
|
What type of database are you trying to connect to? What is the table structure defined as?
|
|
|
|
|
The database is Microsoft Access. It has one Table called Table1. The table has 3 fields - Date, Task, Duration and a Auto Number ID Primary Key Field.
Please let me know if you need more info
Thanks
Regards
ensuvari
|
|
|
|
|
I want to attach the files and folder images with their respective nodes.
Earlier I got the reply in the form of following code.
Private myimagelist as new imagelist
dim icon as Drawing.icon
myimagelist.colordepth = colordepth.depth32bit
myimagelist.imagesize = new size(16,16)
icon = me.icon
myimagelist.image.add(new drawing.icon(icon ,16 ,16))
treeview.imagelist=myimagelist
Now my question is divided in two parts
1. C:\Document and settings
2. C:\a.txt
In the first case I want to combine the image of folder docomentand settings
but how I will extract the docoment and settings folder icon and How it will be possible to write
icon = "C:\Document and settings"
Same is for the second case
-- modified at 9:10 Tuesday 28th February, 2006
|
|
|
|
|
Hi is there a way of JUST turning on VERTICAL gridlines in a DATAGRID control.
|
|
|
|
|
Sorry just to clarify .. What I mean by turn on is set the colour.
Ie change the vertical colour of the gridlines.
|
|
|
|
|
hi there
can anyone please give me a site that downloads the SNA server version 4
thanks alot
|
|
|
|
|
I have a textbox .I want to bind it with the first row and first column of the particular table(sql server).I mean at run time textbox should display the value .Before that i have made the connection .
Dim dataset as new dataset
dim connection as new sqlconnection("workstation id =abc ; Packet size = 4096 ; integeration security = SSSI ; Data Source = . ; Persist Security info = False ; initial catalog = abcd")
dim tablename as string = "Select * from table"
dim adapter as new Sqldataadapter(tablename , connection)
And on form load
adapter.fill(dataset , tablename)
|
|
|
|
|
I want to populate the listview with the no of database files of sql server during the form load programically.
Please help me.
Thanks and Regards
Pankaj Garg
|
|
|
|
|
Hi all,
Please can you help me on this. I want to create a class dynamically which is inherited from StringConverter with help of Reflection.Emit.
Class
---------------------------------
Public Class EngStatusConverter
Inherits StringConverter
Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As ITypeDescriptorContext) As Boolean
Return True
End Function
Public Overloads Overrides Function GetStandardValues(ByVal context As ITypeDescriptorContext) As StandardValuesCollection
Return New StandardValuesCollection(New String() {"RUNNING", "IDLE"})
'Return New StandardValuesCollection(sStdValues)
End Function
Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As ITypeDescriptorContext) As Boolean
Return True
End Function
End Class
Using Reflection.Emit
----------------------------
Dim oTypeBuilder As TypeBuilder = Nothing
Dim oMethodBuilder As MethodBuilder = Nothing
Dim oILGenerator As ILGenerator = Nothing
Dim oConstructorInfo As ConstructorInfo = Nothing
Dim oParams() As Type
Try
oTypeBuilder = foModuleBuilder.DefineType("EngStatusConverter", TypeAttributes.Class, GetType(StringConverter))
oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValuesSupported", MethodAttributes.Public, GetType(Boolean), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oILGenerator.Emit(OpCodes.Ldarg_0, CType(True, Object))
oILGenerator.Emit(OpCodes.Ret)
oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValues", MethodAttributes.Public, GetType(StandardValuesCollection), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oParams = New Type() {GetType(String)}
oConstructorInfo = GetType(StandardValuesCollection).GetConstructor(oParams)
oILGenerator.Emit(OpCodes.Ldarg_0, oConstructorInfo)
oILGenerator.Emit(OpCodes.Ret)
oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValuesExclusive", MethodAttributes.Public, GetType(Boolean), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oILGenerator.Emit(OpCodes.Ldarg_0, CType(True, Object))
oILGenerator.Emit(OpCodes.Ret)
Return oTypeBuilder.CreateType
Catch ex As Exception
Throw ex
End Try
But this is not working. Can you help me on this.
|
|
|
|
|
hello
again i have a new problem which makes me crazy....how can i invoke other application like word,excel,acrobat and so on....coz in my case,,first i have to locate first the last 3 or 4 character to able for me get the specified file name like for example...in my txtbox this is the value: c:\..\mydocuments\sample.doc,,,after i locate the path then click the button show to be able to pop up the microsoft word or excel...how i'm gonna do that can you please help about this...
thanks
|
|
|
|
|
In solution select ad refercnce and select com
and select Microsoft office ...9.0
ADD this before calss declaration
Imports Office = Microsoft.Office.Core
try to make a class like this
...........
or u can use with out class directly
Public Class WordAppl
Private oWordAppl As Word.ApplicationClass
Public Sub New()
oWordAppl = New Word.ApplicationClass
strOfficeNote = "OFFICE NOTE"
' GetTagsFromDB()
iRpl = 0
iTagFound = 0
End Sub
' Open a file (the file must exists) and activate it
Public Sub Open(ByVal strFileName As String)
'//////////////////////////////////////
'/ Opens specified Document file /
'//////////////////////////////////////
Dim fileName As Object = strFileName
Dim readOnly1 As Object = False
'Dim isVisible As Object = True
Dim missing As Object = System.Reflection.Missing.Value
'isVisible
'oDoc = oWordAppl.Documents.Open(fileName, missing, readOnly1, missing, missing, missing, missing, missing, missing, missing, missing, isVisible)
oDoc = oWordAppl.Documents.Open(fileName, missing, readOnly1, missing, missing, missing, missing, missing, missing, missing, missing, True)
oDoc.Activate()
End Sub
Public Sub Open()
Dim missing As Object = System.Reflection.Missing.Value
oDoc = oWordAppl.Documents.Add(missing, missing, missing, missing)
oDoc.Activate()
End Sub
Public Sub Quit()
Dim missing As Object = System.Reflection.Missing.Value
oWordAppl.Application.Quit(missing, missing, missing)
End Sub
Public Sub Save()
oDoc.Save()
End Sub
Public Sub SaveAs(ByVal strFileName As String)
Dim missing As Object = System.Reflection.Missing.Value
Dim fileName As Object = strFileName
oDoc.SaveAs(fileName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing)
End Sub
End Class
Just try it
GOOD LUCK
|
|
|
|
|
How can I kill one specific instance of a timer?
I have this application that works similar to msn messenger
a message is sent and a window display it in a viewlist and raise a warning window
there is 1 form with the listview and another with the warning window 'AlertWindow(messages)'
the one with the listview instantiate the warning form
Dim aFrmAlertPopUp As New AlertWindow(messages, altSysOrigin, alertId, BgColor, userAlias, altTeamMember, altAlertType)
aFrmAlertPopUp.display(messages)
the display method starts a timer
Friend Sub display(ByVal AlertMessage As String)
SyncLock GetType(AlertWindow)
Try
sender = "Bruno"
alertMessageArray = AlertMessage
Me.lblBody.Text = alertMessageArray 'anAlert.message
Me.lblSysOrigin.Text = sysOrigin
imgTopBar.Image = New Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AlertClient.bar.bmp"))
' sideBar.Image = New Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AlertClient.sidebar.bmp"))
startDisplay("A")
AddHandler AlertWindowTimer.Tick, AddressOf TimerEventProcessor
AlertWindowTimer.Interval = 10000
AlertWindowTimer.Start()
countWarnings = 1
Catch ex As Exception
utils.LogException(ex)
End Try
End SyncLock
End Sub
Private Sub TimerEventProcessor(ByVal myObject As Object, _
ByVal myEventArgs As EventArgs)
countWarnings = countWarnings + 1
Select Case countWarnings
Case 2
startDisplay("B")
Case 3
startDisplay("C")
AlertWindowTimer.Stop()
End Select
End Sub
would be possible to make this timer check if the message is still on the listview and stop if the message has been removed?
i have this messenger that shows a window 3 times with timespan breaks of 1 minute
so, what i want to do, is be able to kill one instance of the timer that controls it
lets say it receive a message on you msn messenger, then when the message arrives, it raise the window and start the timer that will show it again every minute for three times
lets say i send you 3 messages 'A' , 'B', 'C', but i want to stop only 'B'
if I simply shut the timer, all the three instances will die
how could i name a timer instance 'B' and shut only that?
I guess it could be solved usin dictionary in V2.o
Protected Shared tdict As New Dictionary(Of Integer, Timer)
but my app is framework 1.1
any ideas?
|
|
|
|
|
hellow ..
how i can use in cystal reports , in select expert the like statment with full options like in the sql statment %Name% ...
thxx
|
|
|
|
|
Isn't there already a "is like" option in the Select Expert?
|
|
|
|
|
Hi guys, I am writing data from dataset into an xml file. However, the xml file does not open correctly either in the browser or in excel. Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this?
With Best Regards,
Mayur
|
|
|
|
|
You'd be better off parsing it with a SAX implimentation rather than the DOM. I believe XMLDataDocument is optimised for this sort of thing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am a fresher in .net. I did not understand what you tried to explain in your reply. please explain it to me in simpler terms.
With Best Regards,
Mayur
|
|
|
|
|
SAX and DOM are the two ( standard ) ways to parse XML. I think if you use the XMLDataDocument class, you might be fine.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
mayhem_rules wrote: Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this?
I'd really question why you want to store that amount of data in an XML file. Many people mistakenly confuse XML for some sort of database - which it is not.
Large amounts of data are better stored in a database.
Is this application sending data to another system which can only accept XML input?
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
-- modified at 17:14 Tuesday 28th February, 2006
|
|
|
|
|
No, I am not using the xml file as a database. Actually the issue is something else. I need to get the records in excel for the user. However, I do not know how to do that. I searched the internet and found information on writing to xml and opening the xml file in Excel. However, the xml file does not open in excel. Maybe the size of the xml file is the issue. I hope u have understood my problem. Please guide me with this. thnx.
With Best Regards,
Mayur
|
|
|
|
|
Ok, I see. Excel can diectly import CSV (comma separated value) files or TAB separated files. Maybe that would be a better way.
With XML, you have the overhead of a begin tag and an end tag wrapping each value which, depending on the tag names, can be rather long and a huge overhead per row of data. CSV (or TAB) delimited files on the other hand incur only a single character overhead between each value in each row of data which equates to a very much smaller file.
For example consider a Customer table defined in the database with the following (abstract) column names:
"CustomerName", "Address", "Country", "TelephoneNumber"
Assume some test data:
"steve", "111 nowhere street", "australia", "123456789"
"brian", "222 right rd", "usa", "123456789"
"tony", "333 left ave", "israel", "123456789"
"angela", "444 circular cres", "mars", "123456789"
"george", "555 main st", "moon", "123456789"
Note that the CSV file format is that shown above - quite compact.
If we extract this data to an XML file, it could end up looking something like this for each row (it is not accurate and is for explanation only):
<Customer>
<CustomerName>steve</CustomerName>
<Address>111 nowhere street</Address>
<Country>australia</Country>
<TelephoneNumber>123456789</TelephoneNumber>
...
</Customer>
Can you see the extra overhead in just one row of data? In this particular case the overhead exceeds the actual row data size. Multiple this by a factor of 50,000 (i.e. the rows in your database) and it is huge.
In short, yes XML is a good way of transporting data between dissimilar applications provided the number of data is relatively low and there is no other viable method.
...Steve
|
|
|
|
|
Steve, Thnx a lot for your reply. That clears much of my doubts. However, my main problem still remains. How do I export data to EXCEL or CSV or TSV. Please help.
With Best Regards,
Mayur
|
|
|
|
|