|
RTF is not the same format as a plain text file - it contains hidden fields for formatting etc.
Although you could read the boot.ini file into a multi-line textbox allow the users to edit it, then save it back to the ini file, I don't think this is a particularly good idea. Anyone who knows how to correctly edit the boot.ini file would know how to edit it from notepad. Anyone who does not know how to do this probably should not be editing it in the first place.
The only thing that is supposed to be in the boot.ini file are the OS descriptions anyway.
If you want to create an app that allows the user to change these, you should write an app that presents them with the three options they can change in the boot.ini - the order in which the available OS are presented, the default OS to boot, and the timeout. Then your app should handle modifying the ini file internally.
If anything else is changed in the ini file, all you've done is corrupt the system.
|
|
|
|
|
OK, I have looked in the registry and have found the following:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control and found the following, SystemBootDevice, SystemStartOptions, WaitToKillServiceTimeout.
Are these the options which you are refering to??
If not how would i go about reading boot.ini to a mutli-line text box.
Also, i will read it to a read only box first, then the user can click edit to open a new window which they can then edit this file in.
-- modified at 17:47 Sunday 25th September, 2005
|
|
|
|
|
No, the options I am referring to come directly from the boot.ini. Here is what mine looks like:
--------------------------------------------------------------------------
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
--------------------------------------------------------------------------
What this means is I have two partitions, 1 has WINNT, 2 has WIN XP.
When my machine boots, the screen comes up with WINNT option listed first, WINXP listed second. That is controlled by the order of the two entries in the [operating systems] section.
If I change the order of the two entries, and NOTHING else should be changed in that section ORDER IS THE ONLY THING YOU CAN CHANGE! then Win XP would appear as the first option instead.
My machine also defaults to WINNT. If I changed this to:
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
then Win XP would be already selected, even if it was not the first in the list.
And timeout is set to 30 - if I do nothing then after 30 seconds the default OS is loaded.
Those are the options controlled by BOOT.INI file.
So instead of using a multiline textbox, I would use for example, a textbox where the user can change the time out value from 30 seconds to whatever.
Then I would use a list box, and add items into it "Windows 2000", "Windows XP" and let them select which they wanted as their default OS.
I would not bother with giving them anything to change the order the OS options appear. I would just write code so that whenever they select a default, that option is automatically moved to the top of the list.
You can open the file and parse it manualy line by line, or you can use built-in Win32 APIs that are specific for wsorking with INI files that will read and write them without you having to parse them by line.
But most users who even have partitions and multiple windows versions configured are "advanced" users. The average user only has one version of Windows installed, so the only option they would have to even change would be the timeout. So I am not sure why you really are even interested in this at all?
But if you want it, I have a module written in VB.NET that wraps the INI APIs into simple function calls that will read and write an INI file with no parsing etc....
|
|
|
|
|
It would be great if you could share the module with me.
Either post here or email administrator@planetnvidia.com.
Thanks for you help.
|
|
|
|
|
Hi all,
I have a serialization class with following procedures.
Public Shared Sub Serialize(ByVal Obj As Object, ByVal FilePath As String)
Dim fs As New FileStream(FilePath, FileMode.OpenOrCreate)
Dim sf As New SoapFormatter
sf.Serialize(fs, Obj)
fs.Close()
End Sub
Public Shared Sub DeSerialize(ByRef Obj As Object, ByVal FilePath As String)
Dim fs As New FileStream(FilePath, FileMode.Open)
Dim sf As New SoapFormatter
Obj = sf.Deserialize(fs)
fs.Close()
End Sub
As it can be guessed, these methods are used for serializing and deserializing objects.
I have a class to be serialized
<serializable()> public class SampleClass
Private Value as Integer
Private Items As New ArrayList
end Class
When I serialize this class, the output will be shown like the data below.
(That shows the class has been successfully serialized)
(PLEASE IGNORE THE NAMES AND VALUES IN THE DATA - IT IS ONLY A SAMPLE)
.....
......
<arraylist_x002b__version>6
<soap-enc:array id="ref-5" soap-enc:arraytype="xsd:anyType[16]">
<item href="#ref-6">
<item href="#ref-7">
<item href="#ref-8">
<item href="#ref-9">
<item href="#ref-10">
<item href="#ref-11">
<a5:uniqueentity id="ref-6" xmlns:a5="http://schemas.microsoft.com/clr/nsassem/PDPweb.Entities/PDPweb%2C%20Version%3D1.2.2094.37416%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull">
<_Name id="ref-12">ID
<entity_x002b__type>UniqueIdentifier
<entity_x002b__required>true
<entity_x002b__check xsi:null="1">
......
......(continues)...
But when I try to deserialize a class (from the data file), only the
"Private Value as Integer" variable is deserialized.
How can I also deserialize an arraylist?
Best Regards
Emre YAZICI
|
|
|
|
|
Dim obj1 As Object
OLE1.Action = 7
Set obj1 = OLE1.object.Application.WordBasic
obj1.Selection.TypeText ("Hello")
'Control Word in OLE
'Error occurs at last line, which is :
'Run-time error '424'
'Object required
'And I use office xp, can I use macro recorded in
' word directly in VB without
' modifying, if can not, how I modify them can be use in VB.
|
|
|
|
|
hi there i have an image i want to save it in access database i want to save the image not the path im using this
Dim tr AsNew ZieZoDB
Dim conn As OleDbConnection
conn = Me.OleDbConnection1
Dim fs As FileStream = New FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
Dim s AsString = Me.txtimagepath.Text
'Read the output in binary reader
Dim r As BinaryReader = New BinaryReader(fs)
'Declare a byte array to save the content of the file to be saved
Dim FileByteArray(fs.Length - 1) AsByte
r.Read(FileByteArray, 0, CInt(fs.Length))
and here is the problem in this query
Try
Dim dbclass AsNew ZieZoDB
Dim query AsString
query = "INSERT INTO [StudentInfo] ([StudentID], [StudentImage], [StudentCardNumber] , [StudentName]) VALUES
('" & Me.txtstudentid.Text&"' ,,(???????????),'" & Me.txtcardnmber.Text & "', '" & Me.txtname.Text & "');"
dbclass.executeNonQuery(query)
what should i put for the image in the query to save thanks
sam
|
|
|
|
|
Dim rs As New ADODB.Recordset
Dim Rss As New ADODB.Stream
rs.Open "select [StudentID], [StudentImage], [StudentCardNumber], [StudentName] from [StudentInfo]", cn, adOpenStatic, adLockOptimistic
Rss.Type = adTypeBinary
Rss.Open
Rss.LoadFromFile OpenFileDialog1.FileName
rs.AddNew
rs.Fields("StudentID") = Me.txtstudentid.Text
rs.Fields("StudentImage") = Rss.Read
rs.Fields("StudentCardNumber") = Me.txtcardnmber.Text
rs.Fields("StudentName") = Me.txtname.Text
rs.Update
rs.Close
|
|
|
|
|
thx 4 ur reply i wanna ask u with this way if i have an empty textbox can i save the data
because for example i dont hve the whole information of the student but i have to save the other data and thanx again 4 ur reply
sam
|
|
|
|
|
You can take a test with empty textbox to write to database, to see if you can do in this way. And if you can, you can open the database file in Access to take a look what value is store in it.
|
|
|
|
|
Private Sub Form_Load()
Combo1.Text = "1&2&3"
'I want to display "1&2&3" but it displays "123"
End Sub
|
|
|
|
|
It should't (I paste that into a new form, add a combobox called combo1 and
run it and I get "1&2&3" displayed in it) are you sure you didn't put:
combo1.text = "1" & "2" & "3"
|
|
|
|
|
Hi there,
i have a program which check the url in database and using the http Response and request method it give me the out put whether the given url is valid r broken, my application work fine but when some url pass in this formate like "www.something.com/" my application is not working when url pass with the "/" pls help me how to solve this problem how to pass the url or how to truncate the slash "/"... pls give me some solution
This is the code snippet
------------------------------------------------------------------------
Public Function checkurl(ByVal url As String) As String
Dim req As System.Net.HttpWebRequest
Dim res As System.Net.HttpWebResponse
Dim r As System.IO.StreamReader
Dim ex As Exception 'error exeption holder
Dim pge As String 'page holder
Dim strreturnstring As String
Try
'display request url
req = req.Create(url)
req.AllowAutoRedirect = True
'set the user agent
'some site might brush you off if it is not set
'to stop bots and scrapers
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"
'get page
res = req.GetResponse()
r = New System.IO.StreamReader(res.GetResponseStream())
pge = r.ReadToEnd
r.Close()
res.Close()
strError = "OK"
status = "True"
'Convention is First Value is the Status and Second value is Errmsg
strreturnstring = status & "~" & strError
Return strreturnstring
Catch ex
status = "False"
strError = ex.Message
strreturnstring = status & "~" & strError
Return strreturnstring
End Try
End Function
--------------------------------------------------------------------
this is the code snippet for select from database
objConn.Open()
da = New SqlClient.SqlDataAdapter("Select SRNO, IDENTIFIER, TITLE, PHY_PATH as IDENTIFIER_URL," & _
" BROKEN_LINK_INFORMATION='', STATUS='' from web_resource where PHY_PATH like ''http://sunsite.berkeley.edu/''", conn)
da.Fill(ds)
Dim strValues As String
If ds.Tables(0).Rows.Count > 0 Then
For I As Integer = 0 To ds.Tables(0).Rows.Count - 1
strValues = checkurl(ds.Tables(0).Rows(I).Item("PHY_PATH"))
Dim strArrvals As String()
strArrvals = strValues.Split("~")
If strArrvals.Length > 0 Then
strError = strArrvals(1).ToString()
status = strArrvals(0).ToString()
End If
ds.Tables(0).Rows(I).Item("ERROR") = strError
ds.Tables(0).Rows(I).Item("STATUS") = status
Next
fncExcelExport(ds)
End If
-------------------------------------------------------------
regards
cyus
-- modified at 6:10 Sunday 25th September, 2005
|
|
|
|
|
'Pass your url in, and if it has '/' in tail, truncate it, if no '/' in the end, do nothing.
Public Function TruncIt(strUrl As String)
Dim pos As Integer
Dim len1 As Integer
If Len(strUrl) = 0 Then Exit Function
pos = InStrRev(strUrl, "/")
len1 = Len(strUrl)
If pos = len1 Then
'MsgBox "Trunc it."
strUrl = Mid(strUrl, 1, len1 - 1)
TruncIt = strUrl
Exit Function
End If
TruncIt = strUrl
End Function
|
|
|
|
|
Public Function Compl(strUrl As String)
If InStr(strUrl, "http://") <> 1 Then
strUrl = "http://" & strUrl
End If
If InStrRev(strUrl, "/") <> Len(strUrl) Then
strUrl = strUrl & "/"
End If
Compl = strUrl
End Function
|
|
|
|
|
Hi
I am new to Windows API programming and a relative newbie anyway, but need to accomplish a simple task - find out which API calls to make to see if a particular application is loaded and running and how to use them.
Could anyone supply the VB code to do this?
Thanks in advance
|
|
|
|
|
Do you have to use the api? You can use:
Dim count As Integer
count = Process.GetProcessesByName("Notepad").Length
Select Case count
Case 0
MessageBox.Show("Notepad is not running")
Case 1
MessageBox.Show("Notepad is running")
Case Else
MessageBox.Show(count.ToString & " Notepads are running")
End Select
|
|
|
|
|
|
Would like to know how to display the listbox item into datagrid.
Example : if i select a item(customer id) in the listbox, the datagrid would display the customer details.
|
|
|
|
|
To do this you must query everytime to the database..
e.g when you select customer id in the Listbox....query for the details in the database to find records against that customer id and display them in the grid as usual.....
Any problem?
_mubashir
|
|
|
|
|
Greetings,
Really hope that someone can throw me a clue on this!!
I developed a vb.net application that will use a dll built by MATLAB. Base on the code below, TEST is the dll name and an error occured while the application trying to execute this line ==> "objCount.test2(1, objOutput, A)"
Dim objCount
objCount = New TEST.countClass
objCount.test2(1, objOutput, A)
Error:
An unhandled exception of type
" 'System.Runtime.InteropServices.COMException' occurred
in SAMPLE.exe
I tried to set the system path variable. But, I still fail to solve the problem. Any expert out there could enlighten me?
Thank you.
-- modified at 3:59 Sunday 25th September, 2005
|
|
|
|
|
hey,
i need to communicate between processes in the same system using VB .Net. I was looking at shared memory, but am not sure how to implement it. I am new to this stuff and hence wud appreciate ur help.
thanks,
kalyan
|
|
|
|
|
I'm trying to make a program that sends data to another computer throught a net.
I have follow an example but I can not establish connection.
In the sender, I have this code:
'CREAR EL SOCKET Y CONECTAR<br />
Dim iphe As IPHostEntry = Nothing<br />
iphe = Dns.Resolve(server)<br />
<br />
Dim ipad As IPAddress = iphe.AddressList(0)<br />
<br />
ipad = iphe.AddressList(0)<br />
Dim ipe As New IPEndPoint(ipad, port)<br />
Dim tmpS As New Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp)<br />
<br />
tmpS.Connect(ipe)<br />
<br />
'******************************************<br />
<br />
'ENVIAR<br />
Dim ASCII As Encoding = Encoding.ASCII<br />
Dim envio As String = Me.txtAccion.Text<br />
Dim ByteGet As [Byte]() = ASCII.GetBytes(envio)<br />
Dim RecvBytes(255) As [Byte]<br />
Dim strRetPage As [String] = Nothing<br />
<br />
tmpS.Send(ByteGet, ByteGet.Length, 0)
And in the client pc I have this code:
'CREAR EL SOCKET Y CONECTAR<br />
Dim iphe As IPHostEntry = Nothing<br />
iphe = Dns.Resolve(server)<br />
<br />
Dim ipad As IPAddress = iphe.AddressList(0)<br />
ipad = iphe.AddressList(0)<br />
<br />
Dim ipe As New IPEndPoint(ipad, port)<br />
Dim tmpS As New Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp)<br />
<br />
tmpS.Connect(ipe)<br />
<br />
'******************************************<br />
<br />
'RECIBIR<br />
Dim ASCII As Encoding = Encoding.ASCII<br />
Dim [Get] As String = "GET / HTTP/1.1" + ControlChars.Cr + ControlChars.Lf + "Host: " + server + ControlChars.Cr + ControlChars.Lf + "Connection: Close" + ControlChars.Cr + ControlChars.Lf + ControlChars.Cr + ControlChars.Lf<br />
Dim ByteGet As [Byte]() = ASCII.GetBytes([Get])<br />
Dim RecvBytes(255) As [Byte]<br />
Dim strRetPage As [String] = Nothing<br />
<br />
' Receive the server home page content.<br />
Dim bytes As Int32 = tmpS.Receive(RecvBytes, RecvBytes.Length, 0)<br />
<br />
' Read the first 256 bytes.<br />
strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes)<br />
<br />
While bytes > 0<br />
bytes = tmpS.Receive(RecvBytes, RecvBytes.Length, 0)<br />
strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes)<br />
End While<br />
<br />
MessageBox.Show(strRetPage)
Maybe all the code is wrong (sure!). Someone can help me with this?
Maybe there is an easy way to make this... I'm sure someone will teach me
|
|
|
|
|
How to view Vedio Stream in VB6? How to captures stills from it and store?
Shoaib Nawaz
|
|
|
|
|
Hello,
Thanks to an article I found here, I finally have figured out how to put a combobox into my datagrid.
It works great!
I'm still going through it, trying to figure out how it works (and why it works
Now I'm struggling with this:
I populate my datagrid with a SQL command that pulls a table from SQL.
I populate the values in my combobox with a SQL command that pulls several items from a different table.
When I click on my column in the datagrid that triggers the combobox, and select a value from my combobox, then move to another cell in the datagrid, how do I keep my newly selected item?
I'm having trouble wrapping my head around how best to do this...
Thanks in advance!
Amber
|
|
|
|
|