|
If you're going to call yourself "code master", you better know what you're doing and why this is a bad idea.
Can it be done? Yeah, but with extreme difficulty. Check out Cosmos[^], a (mostly) C# written OS.
|
|
|
|
|
A very tall order there. You probably can make an OS in VB, but why? In the development of an OS, there's too much that goes on to just post.
""Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
No you can't; all you can make in a higher-level language is a virtual OS, one that runs on top of a real one. For a real OS, one needs pre-emptive scheduling which requires access to all the CPU registers, so one can swap one process/task/thread for another one, saving/restoring the state in some data structures. C#, Java, VB and other HLL's don't provide access to (all relevant) CPU registers.
I've constructed a number of OSes using C; it takes one or two pages of assembly code at least to implement proper process/task/thread switching. Everything else could be implemented in the HLL, although optimal interrupt handling may beg for some assembly code too.
One could argue that in-line assembly could be used (probably not in VB), but I would not really consider that as the compiler will insist on adding some code I don't want, and performance should not be wasted in task switching or interrupt servicing.
|
|
|
|
|
Luc Pattyn wrote: all you can make in a higher-level language is a virtual OS
Very true.
""Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
In VB, that would be called a 1s. 0s are made in C#.
|
|
|
|
|
I'm googled all day long and can't seem to find a good example of this. I'm trying to write a VB.NET Windows Form Application to submit a XML request to a web service via a POST to a URL. And get the response. I've found plenty for VB6 but these don't work for Visual Studio. Can someone point me in the right direction? Thanks
|
|
|
|
|
Member 7743805 wrote: found plenty for VB6 but these don't work for Visual Studio
Have you tried to make the appropriate changes to VB.Net if possible?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Maybe this will help ...
I've cut & Pasted some of the relevant code and had to make a few changes to obfuscate the server and other proprietary business logic.
I'm very new to the webservice arena so this might not be the best way to implement it, but it is working for me.
The idea is that a salesman can make a webService request for a Product price quote.
sURL = "http://myServer/myApp/TQWebService.asmx?op=CreateQuoteRequest"
WRequest = WebRequest.Create(sURL)
WRequest.Method = "POST"
WRequest.Credentials = System.Net.CredentialCache.DefaultCredentials
SOAPdata = BuildSoapTQRequest(Salesman, ProductCode)
WRequest.ContentType = "application/soap+xml; charset=utf-8"
WRequest.ContentLength = SOAPdata.Length
postStream = WRequest.GetRequestStream()
postStream.Write(SOAPdata, 0, SOAPdata.Length)
postStream.Close()
Try
WResponse = WRequest.GetResponse()
responseStream = WResponse.GetResponseStream
Dim sr As New StreamReader(responseStream)
xDoc.LoadXml(sr.ReadToEnd)
Private Function BuildSoapTQRequest(ByVal ReqID As String, ByVal ProductCode as String) As Byte()
Dim sb As New StringBuilder
sb.Append("<soap12:Envelope xmlns:xsi=" + Chr(34) + "http://www.w3.org/2001/XMLSchema-instance" + Chr(34) + " xmlns:xsd=" + Chr(34) + "http://www.w3.org/2001/XMLSchema" + Chr(34) + " xmlns:soap12=" + Chr(34) + "http://www.w3.org/2003/05/soap-envelope" + Chr(34) + "> ")
sb.Append(System.Environment.NewLine)
sb.Append("<soap12:Body> " + System.Environment.NewLine)
sb.Append("<CreateQuoteRequest xmlns=" + Chr(34) + "http://myServer/" + Chr(34) + "> " + System.Environment.NewLine)
sb.Append("<myRequestorID>" + ReqID + "</myRequestorID>" + System.Environment.NewLine)
sb.Append("<myProductCode>" + ProductCode + "</myProductCode>" + System.Environment.NewLine)
sb.Append("</CreateQuoteRequest> " + System.Environment.NewLine)
sb.Append("</soap12:Body> " + System.Environment.NewLine)
sb.Append("</soap12:Envelope> " + System.Environment.NewLine)
Return Encoding.ASCII.GetBytes(sb.ToString)
End Function
|
|
|
|
|
I'm moving from VB6 to VS 2008. And need help with a data
structure problem.
In a Public code module in my VS 2008 project, I defined a structure:
Public structure db_connection
dim connection_string as string
End structure
Then defined a variable as the structure type:
Public db_con as db_connection
When I pass the db_con variable to a sub:
sub db_create_cs(dbc as db_connection)
dbc.connection_string = "some values"
end sub
I expected the db_con.connection_string value
to equal "some values" after the call.
Regards.
|
|
|
|
|
Check to see if in your declaration,
sub db_create_cs(dbc as db_connection)
the parameter is ByRef as opposed to ByVal.
Also, you might want to re-structure your program to define db_create_cs as a function rather than a sub. (my 2 cents)
Hope this helps.
|
|
|
|
|
ByRef cured the problem. I was going down fast. thanks
In the actual program it is a function. I slimmed down the
code for my question. Thanks for the comment though, and help.
|
|
|
|
|
If you don't specify "ByRef" or "ByVal", then the parameter is "ByVal" by default.
You want:
Sub db_create_cs(ByRef dbc As db_connection)
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
I thought I checked that. It fixed the problem.
Thanks for the help.
I sense a series of adjustments going from VB6 to
VS 2008 is ahead.
|
|
|
|
|
The problem is that for VB6, the default was "ByRef", but for VB.NET, the default is "ByVal".
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Hello all, i have been making a few Visual Basic Applications as a bit of a hobby. Is there anyway to make an application read some files that contain code and have a program act accordingly. in other words have a add-on/plug-in system for a program.
Any help is appreciated! thanks!
|
|
|
|
|
There is a namespace in .Net called CodeDom , which can be used to compile and run code on-the-fly so to speak. If you google vb codedom you should get plenty of hits with a good tutorial.
Good Luck
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
|
|
Please help on this code. I tried to update record in datetime field in access but yields concurrency exception. Tnxs.
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'saves edited record.
If MessageBox.Show("Sure to save record?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
Dim qryTask As String = "SELECT * from tblTask where fix(task_id) = '" & id & "'"
daTask.SelectCommand = New OleDbCommand(qryTask, connection)
Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(daTask)
daTask.Fill(dsTask, "tblTask")
dtTask = dsTask.Tables("tblTask")
bolSave = True 'user saved changes.
Dim intCatId% = -1
dtTask = dsTask.Tables("tblTask")
Dim strMonth As String = Format(Me.dtpDeadline.Value, "MM")
Dim strDate As String = Format(Me.dtpDeadline.Value, "dd")
Dim strYear As String = Format(Me.dtpDeadline.Value, "yyy")
Dim strCat$ = Trim(Me.cboCategory.Text)
intCatId = udfCategoryId(strCat)
If Me.txtTask.Text = "" Or Me.txtDetails.Text = "" Then
MessageBox.Show("Please fill up Task and Task Details!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
End If
'check date.
If Trim(strStartTime) = "" Then
If Trim(Me.txtStartTime.Text) = "" Then
strStartTime = ""
Else
strStartTime = Trim(Me.txtStartTime.Text)
End If
ElseIf Trim(strStartTime) <> "" Then
If Trim(Me.txtStartTime.Text) = "" Then
strStartTime = ""
Else
strStartTime = strStartTime
End If
End If
''check date.
If (strEndTime) = "" Then
If Trim(Me.txtEndTime.Text) = "" Then
strEndTime = ""
Else
strEndTime = Trim(Me.txtEndTime.Text)
End If
ElseIf Trim(strEndTime) <> "" Then
If Trim(Me.txtEndTime.Text) = "" Then
strEndTime = ""
End If
End If
Try
With dtTask
.Rows(0)("Task") = IIf(txtTask.Text = "", System.DBNull.Value, txtTask.Text)
.Rows(0)("Task_Details") = IIf(txtDetails.Text = "", System.DBNull.Value, txtDetails.Text)
.Rows(0)("Task_Status") = IIf(txtStatus.Text = "", System.DBNull.Value, txtStatus.Text)
.Rows(0)("Deadline") = Format(Me.dtpDeadline.Value, "MM/dd/yyy")
.Rows(0)("Year_Deadline") = Format(Me.dtpDeadline.Value, "yyy")
.Rows(0)("Task_Category_Id") = CInt(intCatId)
.Rows(0)("Start_Time") = IIf(strStartTime = "", System.DBNull.Value, FormatDateTime(strStartTime, DateFormat.LongTime))
.Rows(0)("End_Time") = IIf(strEndTime = "", System.DBNull.Value, FormatDateTime(strEndTime, DateFormat.LongTime))
End With
daTask.Update(dsTask, "tblTask")
MessageBox.Show("Record successfully saved!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As OleDbException
MsgBox(ex.ToString)
End Try
Else
MessageBox.Show("Record not saved.", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
|
|
|
|
|
Hello;
Please don't bother to answer this query. I found out the culprits - the same variables declared globally.
Tnxs.
|
|
|
|
|
digibat wrote: I found out the culprits - the same variables declared globally
Kudos to you! In the future if you post code, please use the pre tags to make the code more readable in these forums
""Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi, i find a super trojan (server + client work perfectly) at Here
<mg src="http://www.007.somee.com/resim/paradise.jpg">
---you will see the source code at the program menu.
|
|
|
|
|
and??
modified 29-May-12 10:21am.
|
|
|
|
|
Spreading virus-code is an offence in the Netherlands. Keep that in mind on your next holiday, it may be one that lasts four years (or a fine of 25.000 Euro's)
Bastard Programmer from Hell
|
|
|
|
|
looking for usable code sending attachment with winsock in vb6, I don't know how to encode and send. anybody give me a post ? Thank you so much!
|
|
|
|