|
Could somebody give the code for listing all the nodes by name or IP address in a network.
Thankyou
|
|
|
|
|
is there got some more example code that i can refer if i wan to automatically update the database when new data that being detected?
let say i have 4 textboxes which will display the data that being extracted .the data that will stored into database just either will b 0 or 1 oni...
thanks..
|
|
|
|
|
You might want to look at timers and triggers.
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
I have created an ocx in vb, i want to place this ocx in vb.net form .
I am developing one test device application for my purpose.
I am selecting the ocx from customerise toolbox but is not showing in the toolbox (invisible to me)... and also for some dll files it is showing in disable mode..Please help me out immediately to get out of this problem..
Thanking you
|
|
|
|
|
You have to add reference of the dll of the user control
and then drag the .dll file from the solution explorer to tool box. you get the control.
Best Regards,
Chetan Patel
|
|
|
|
|
Hello
I have been using VB for an @ page directive extender. I now need to add code for Paypal PDT (Payment Data Transfer). This code is currently commented out in my project as you can see.
The first chunk of code is for extending the @ page directive.
'Imports System '1
'Imports System.Web.UI '1
'Imports System.Web.UI.HtmlControls '1
'Imports System.Web.UI.HtmlControls.HtmlGenericControl '1
'Partial Class Store_thankyou '1
' Inherits BasePage '1
' Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load'1
' Dim body As HtmlGenericControl'1
' body = Master.FindControl("body")'1
' body.Attributes.Add("class", "store")'1
' End Sub
'End Class '1
The 2nd chunk of code is for the paypal side of things:
Imports System.Net
Imports System.IO
Imports System.Text
Public Class store_thankyou
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim tx, PDTvalidateQuery, token As String
Dim strResponse As HttpWebResponse
Dim temp As String
Dim PDTArray() As String
Dim iParts, sResults(0, 0), aParts(), sParts(), sKey, sValue As String
Dim i As Integer
Dim firstname, lastName, itemName, mcGross, mcCurrency As String
'set this to token from PayPal account
token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
'set tx to value of tx passed in via Querystring from PayPal
tx = Request.QueryString("tx")
'set string = to the cmd value, tx and at that needs to be
'POSTed back to PayPal to validate the PDT
PDTvalidateQuery = "cmd=_notify-synch&tx=" & tx & _
"&at=" & token
'Now we need to POST this info back to PayPal for validation
'of the PDT
' Create the request back
Dim req As HttpWebRequest = CType(WebRequest.Create("https://www.sandbox.paypal.com/cgi-bin/webscr"), _
HttpWebRequest)
' Set values for the request back
req.Method = "POST" 'set method
'set content type
req.ContentType = "application/x-www-form-urlencoded"
'set length
req.ContentLength = PDTvalidateQuery.Length
' Write the request back to PayPal
Dim stOut As StreamWriter = New StreamWriter(req.GetRequestStream(), _
Encoding.ASCII)
stOut.Write(PDTvalidateQuery)
stOut.Close()
Try
strResponse = CType(req.GetResponse(), HttpWebResponse)
Catch ex As SystemException
'############################################
'ADD CODE HERE TO HANDLE AN EXCEPTION IF THE SCRIPT
'CANNOT GET THE RESPONSE FROM PAYPAL
'############################################
End Try
'Once we write the stream back to PayPal, we need to read the
'response.
Dim IPNResponseStream As Stream = strResponse.GetResponseStream
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New StreamReader(IPNResponseStream, encode)
'read the response into a String variable "temp"
temp = readStream.ReadToEnd
'Check to see if the 1st line of the response was "SUCCESS"
If Mid(temp, 1, 7) = "SUCCESS" Then
'if it is SUCCESS, the code below puts the
'response in a nice array
temp = Mid(temp, 9)
sParts = Split(temp, vbLf)
iParts = UBound(sParts) - 1
ReDim sResults(iParts, 1)
For i = 0 To iParts
aParts = Split(sParts(i), "=")
sKey = aParts(0)
sValue = aParts(1)
sResults(i, 0) = sKey
sResults(i, 1) = sValue
'add more case statements here in order to access other returned variables
Select Case sKey
Case "first_name"
firstname = sValue
Case "last_name"
lastName = sValue
Case "item_name"
itemName = sValue
Case "mc_gross"
mcGross = sValue
Case "mc_currency"
mcCurrency = sValue
End Select
Next
'############################################
'This is where the script begins to output the
'receipt page.
'############################################
Response.Write("<h2><b>Thanks for your Order!!</b></h2><br><br>")
Response.Write("<li>Name: " & firstname & " " & lastName & "</li>")
Response.Write("<li>Description: " & itemName & "</li>")
Response.Write("<li>Amount: " & mcCurrency & " " & mcGross & "</li>")
Response.Write("<hr>")
'debug
OutputEntirePDTString(temp)
Else
' IF PDT response is "FAIL" - investigate
Response.Write("Error - PDT FAIL")
End If
'close opened streams
readStream.Close()
strResponse.Close()
End Sub
Private Function OutputEntirePDTString(ByVal myPDTString As String) As String
Dim tempString() As String = Split(myPDTString, vbLf)
Dim x As Integer
For x = 0 To tempString.GetUpperBound(0)
Response.Write(tempString(x) & "<br>")
Next
End Function
End Class
How can I get the two pieces of code to work together?
|
|
|
|
|
Using Partial Class
Best Regards,
Chetan Patel
|
|
|
|
|
Thanks for the quick response. I am doing some investigation on partial classes but so far have not been able to get that to work. I can get the PDT side to work as a partial class but then the @page directive extender does not work. I am new to all this, it may be easy to do but I am not certain. I am learning however. Does anyone have any more details for me to go by?
|
|
|
|
|
I m busy now i will send you email later
Best Regards,
Chetan Patel
|
|
|
|
|
Thanks I really do appreciate it.
|
|
|
|
|
As embarrising as this is to ask, my training goes back to gosub and goto days (the dinosaur blushes).
I have a registration form which has buttons and textboxes for various data collection and branching off to other forms, so how do I tell all textboxes to...
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
"gosub" to (for example)
Private Sub DataChange
and then perform the various changes I require (ie. forecolor change, enable etc) which I can do ok.
Additional: Have tried to Call the required Sub but don't know what to put for all the By Val stuff.
-- modified at 19:20 Monday 10th September, 2007
|
|
|
|
|
frankiebaby2 wrote: Additional: I guess I have to "Call" my sub proceedure then yes?
Correct, calling a method is a gosub, it always returns. Goto exists within a method, but you cannot call a method and give it full control, it always comes back.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks again for you help by confirming the Call method Christian, just now trying to sort out the simple syntax for it.
Private Sub Textbox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Textbox1.TextChanged<br />
Call DataChange() 'Having troubles here<br />
End Sub
'Guessed to put "RuntimeTypeHandle" in here, but not sure what is required
Private Sub DataChange(ByVal sender As System.RuntimeTypeHandle)<br />
btnAccept.ForeColor = Color.Red<br />
<code>etc....
End Sub
-- modified at 20:15 Monday 10th September, 2007
|
|
|
|
|
There is no Call keyword, AFAIK. Your issue is that you need a RuntimeTypeHandle to pass in. If the param is called sender, then this is obviously an event, your best bet is to factor the code out, so that DataChange and Textbox1_TextChanged both call the same method. If you don't use the parameter, another approach is to pass Nothing as the parameter, but if the code uses 'sender', this will cause a null reference exception, as you're essentially saying - here's an object with no value.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks again for your speedy reply Christian.
I am so confussed. The RuntimeTypeHandle was just an attempt to put something there to make it work. I don't understand, so I'll just attempt to rephrase what I need.
When for example text is changed in Textbox1,2,3,4 or 5, I need a command, method or whatever to do the same proceedure.
I created the "DataChange" sub to try to pervent repeating the same command lines in each Textbox(x)_TextChanged.
My previous program language was a VERY long time ago, so I need to keep it simple. Sample code speaks to me the clearest I think.
Thanks
|
|
|
|
|
frankiebaby2 wrote: The RuntimeTypeHandle was just an attempt to put something there to make it work.
Where did you get it from ? What does it do ? If you never access the variable, remove it and all your problems are solved.
I'd love to give you more sample code, but I really don't know what you're after. A sender is usually an object, it was only the variable name that made me think this was something I'd just not seen before. So, if you don't use sender in your method, remove it from the parameters, and then the command
DataChange()
is all you need ( being VB, you may not even need brackets ).
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ok, how's this....
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged<br />
'Need code here to go and run the DataChanged Sub below.<br />
End Sub<br />
<br />
Private Sub DataChange()<br />
btnAccept.ForeColor = Color.Red<br />
btnAccept.Enabled = True<br />
btnNoteboard.Enabled = False<br />
btnLab.Enabled = False<br />
btnJobReg.Enabled = False<br />
btnSmplReg.Enabled = False<br />
btnBusiness.Enabled = False<br />
End Sub
Sorry, I know this must be so simple for you, but I am catching up slowly to VB.Net. I appreciate your patience.
It's OK I GOT IT!!! Thanks so much for your help
|
|
|
|
|
frankiebaby2 wrote: It's OK I GOT IT!!! Thanks so much for your help
*grin* Awesome. Glad to help out.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
how to insert a record in ms access
joe
|
|
|
|
|
You've created two accounts, to post the same question twice, when typing it verbatim into google would flood you with answers more detailed than you could hope to get from a forum reply ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
how to insert records in ms access
The email you supplied has already been registered. Please choose another.
No article notification email address was supplied. We'll use your login email instead (if possible).
|
|
|
|
|
edwin_manic wrote: how to insert records in ms access
Using what? (I assume you don't mean by opening the table in Access and typing the data in)
|
|
|
|
|
Hello all!
I've encountered a problem when I have have my drawings drawn onto a bitmap.
The problem comes when i repaint the bitmap. It seems that any text that i have is distorted (seems like an awful bolded text), while the charts and lines all looked fine.Certainly if I were to draw everything onto screen without saving onto a bitmap first, then the displayed text has no problem showing up perfectly.
So hmm, what could the problem be?
The font type,style or graphicsUnit?
'Display Text and Values<br />
strText = "(" & arrayTable(arrayLoc).estimated_StartDate & "," & arrayTable(arrayLoc).Duration & ")"<br />
<br />
grfx.DrawString(strText, New Font("VERDANA", 7.0, FontStyle.Regular, GraphicsUnit.Point), Brushes.Black, (x1 + bar_Width + line_Width), y1 + yCenter - 6)
Or the way i'm saving it into the bitmap?
Dim grfx As Graphics = pnl_Chart.CreateGraphics()<br />
grfx = Graphics.FromImage(new_snapshot)
Or the problem on the paint event?
e.Graphics.DrawImage(new_snapshot, 0, 0)
Anyway, I feel this is not the most efficient way for storing/displaying something but its what i've only managed, so any suggestions on performance issues?
Thanks in advance!
Regards,
Jensen
|
|
|
|
|
Are you performing some transformations, as in Graphics.ScaleTransform() and many others?
What is the size of your Bitmap?
jensenx wrote: Or the way i'm saving it into the bitmap?
You are not really saving to bitmap, you are drawing inside the Bitmap, aren't you?
You might consider showing the entire bitmap creation, graphics and drawing method,
as well as the Paint handler.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Yup, i'm drawing it into bitmap
Here goes,
Private Sub DrawBars_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles pnl_Chart.Paint<br />
e.Graphics.Clear(Color.White)<br />
<br />
If chart_NoChange = False Then<br />
chart_NoChange = True<br />
new_snapshot = New Bitmap(pnl_Chart.Size.Width, pnl_Chart.Size.Height, pnl_Chart.CreateGraphics())<br />
<br />
drawBarChart()<br />
<br />
e.Graphics.DrawImage(new_snapshot, 0, 0)<br />
e.Dispose()<br />
<br />
Else<br />
e.Graphics.DrawImage(new_snapshot, 0, 0)<br />
e.Dispose()<br />
End If<br />
<br />
End Sub<br />
<br />
Public Sub drawBarChart()<br />
<br />
Dim brush_Handle As Integer = 1<br />
Dim strText As String<br />
Dim clearForm As Boolean = True<br />
<br />
Dim grfx As Graphics = pnl_Chart.CreateGraphics()<br />
<br />
'TEST DRAW ON BITMAP<br />
grfx = Graphics.FromImage(new_snapshot)<br />
<br />
Dim yCenter As Integer = (bar_Height / 2)<br />
<br />
<br />
'Draws today's line<br />
If chk_ShowTodayLine.Checked = True Then<br />
Dim x As Integer = get_xLocation(Date.Today.Date) + (grid_Width / 2)<br />
grfx.DrawLine(Pens.Blue, x, 0, x, pnl_Chart.Height)<br />
End If<br />
<br />
'Draw project's end date<br />
If grid_EndDate <> "" Then<br />
Dim x As Integer = get_xLocation(grid_EndDate) + (grid_Width)<br />
grfx.DrawLine(Pens.Red, x, 0, x, pnl_Chart.Height)<br />
<br />
End If<br />
<br />
Dim arrayLoc As Integer = 0<br />
While arrayLoc <> grid_Task.Rows.Count<br />
<br />
'Normal chart from arraytable-----------------------------------------------------<br />
If arrayTable(arrayLoc).Duration <> 0 Then<br />
'Set values<br />
Dim x1 As Integer = arrayTable(arrayLoc).xLocation<br />
Dim y1 As Integer = arrayTable(arrayLoc).yLocation<br />
Dim bar_Width As Integer = (grid_Width * arrayTable(arrayLoc).Duration)<br />
<br />
'Draw Rectangle<br />
grfx.DrawRectangle(Pens.Black, New Rectangle(x1, y1, bar_Width, bar_Height))<br />
'Highlight selected<br />
If selectedRow = arrayLoc Then<br />
'Fill Rectangle<br />
grfx.FillRectangle(Brushes.Black, New Rectangle(x1 + 1, y1 + 1, bar_Width - 1, bar_Height - 1))<br />
Else<br />
'the +1 and -1 are there to display the rectangle nicely<br />
grfx.FillRectangle(objColorArray(brush_Handle), New Rectangle(x1 + 1, y1 + 1, bar_Width - 1, bar_Height - 1))<br />
<br />
End If<br />
'Display Text and Values<br />
strText = "(" & arrayTable(arrayLoc).estimated_StartDate & "," & arrayTable(arrayLoc).Duration & ")"<br />
grfx.DrawString(strText, New Font("VERDANA", 7.0, FontStyle.Regular, GraphicsUnit.Point), Brushes.Black, (x1 + bar_Width + line_Width), y1 + yCenter - 6)<br />
<br />
brush_Handle += 1<br />
'If goes more than 150 colors been used<br />
If brush_Handle > objColorArray.GetUpperBound(0) Then<br />
brush_Handle = 1<br />
End If<br />
Else<br />
'Those not assigned rows....<br />
End If<br />
'End Normal chart from arraytable--------------------------------------------------<br />
<br />
<br />
<br />
arrayLoc += 1<br />
End While<br />
<br />
<br />
grfx.Dispose()<br />
<br />
<br />
<br />
End Sub<br />
Sorry for the mess! I would gladly clarify parts of my code if it needs to be
|
|
|
|
|