|
Hi,
if you need to send special byte values over SerialPort, forget about text, strings and
encodings, and use SerialPort.Write, which works with byte arrays, no encoding, no
translation. What you get is what you ordered.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
I have 1 server, I using VB.NET to create folder, so can i do?
Thanks
Socheat
|
|
|
|
|
Q. not clear
I have 1 server, I using VB.NET to create folder, so can i do?
????????????????????? ???????????????? /////////
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Using the Directory class, just like you would with a local path using a drive letter specification. The path will change to a UNC format.
I hope you've brushed up on your Windows Networking skills.
|
|
|
|
|
Hi friends,
where can I download Microsoft.DirectX.Direct3DX for free? Thanks.
Cheers,
Joy Anne
|
|
|
|
|
The DirectX SDK can be found here[^]. Warning: Visual Basic.NET documentation and samples were removed a couple of years ago. All code samples are going to be in C# or C++.
|
|
|
|
|
I am unable to show data on datagridview using the following code.
Can anybody help me please. Nothing showing in datagridview but no error message displayed.
Suman
Dim str As String
Dim mycon As New OleDb.OleDbConnection
Dim da As OleDbDataAdapter
Dim ds As New DataSet
Dim dt As New DataTable
Dim dv As New DataView
str = "Provider=Microsoft.jet.oledb.provider.4.0; Data
Source=Nwind.mdb;"
mycon.ConnectionString = str
mycon.Open()
str = "select * from customers"
da = New OleDbDataAdapter(str, mycon)
da.Fill(ds)
DGV.DataSource = ds.DefaultViewManager
|
|
|
|
|
hi,
if dataset contains data(verify it in debug mode) , then
try this code
DGV.DataSource = ds.Tables(0)
in place of
DGV.DataSource = ds.DefaultViewManager
hop this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Sorry, it is not working. Should I change any properties to show data?
Suman
|
|
|
|
|
hi suman,
there r no mistake in code.
are you sure, query return some records ? Verify it in debug mode
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Good Morning fellows,
I always use the following procedure to receive Data from
the Jet-Engine or even from the MS-SQL-Server
Imports System.Data.OleDb
...
Dim oOleDbConnection As OleDbConnection
Dim DBAdapt As OleDbDataAdapter
Dim DT As New DataTable
DIM SQLT as String
Dim DBPath as String
'***Don't forget to specify the correct databasepath
DBPath="C:\mypath\nwind.mdb"
Dim sConnString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DBPath & ";" & _
"User ID=Admin;" & _
"Password="
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
'***check if the Connection had opened correct. If not
'***you receive a first tip where the probleme might be
If oOleDbConnection.State = ConnectionState.Open Then
'***Set the SQL-Statement
SQLT="Select * from Customer;"
'***Create a new Adapter-Object
Dim DBAdapt As New OleDbDataAdapter(SQLT, oOleDbConnection)
'***Because of the fact that we only select Data from one Table
'***it is enough to use a DataTable Object instead of a DataSet
'***And now lets fill it!
OleDbDataAdapter.Fill(DT)
'***we don't need the connection to be open longer, so lets close it.
oOleDbConnection.Close()
'***it will be better to give a Name to the DataTable....
DT.TableName="Customer"
'***lets bind the DataTable to a DataGridView
DGV.DataSource=DT
'***Thats all! This should work!
Else
Call MsGBox("Connection not open!")
End If
|
|
|
|
|
Hi,
I want to create application when i click button i want to show the from like Yahoo Messenger show when user come online,
Please help me
Thanks
Socheat
|
|
|
|
|
hi,
if you search code project, then you can find article about popup form. I already read this article which is in C# but i forget the web address. However i convert it in vb.net .So converted code is following
import statement are following
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
private variable declaration statement and other sub procedure
<br />
Public Class PopUpForm<br />
<br />
Dim X As Integer = 0<br />
Dim Y As Integer = 0 <br />
Private Sub PopUpForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
'*The Screen.GetWorkingArea(control) will provide you the working<br />
'area of a screen without the system tray area. The working area <br />
'depends on the resolution of your monitor*/<br />
<br />
X = Screen.GetWorkingArea(Me).Width ' This line gives the width of working area<br />
Y = Screen.GetWorkingArea(Me).Height ' This line gives the width of working area <br />
Me.Location = New Point(X - Me.Width, Y + Me.Height) ' This line sets the initial location of the form<br />
<br />
Timer1.Enabled = True<br />
Timer1.Start() ' We'll start the timer which handles the opening of form.<br />
End Sub<br />
<br />
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
' The logic is that, first we will open the form below<br />
' taskbar at specified location and then in Timer's TICK event <br />
' we() 'll just bring the form above taskbar to have the animated <br />
' effect.<br />
Dim i As Integer<br />
<br />
i = Me.Location.Y ' First we will know form's Y-axis location<br />
' which will act as upper limit for form's location<br />
If (i > Y - Me.Height) Then<br />
<br />
Me.Location = New Point(X - Me.Width, i - 8) ' Here we just change the location<br />
' of form by 8 pixels(i-8)<br />
<br />
Else ' else we stop Timer1 and start Timer3 which holds the form for some time<br />
<br />
Timer1.Stop()<br />
Timer1.Enabled = False<br />
<br />
Timer3.Start()<br />
Timer3.Enabled = True<br />
End If<br />
End Sub<br />
<br />
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick<br />
<br />
'Here the logic is same as opening the form, only location value of Y-axis<br />
'is increased, so that form slowly hides behind Task Bar.<br />
<br />
Timer3.Stop()<br />
Timer3.Enabled = False<br />
Dim i As Integer<br />
i = Me.Location.Y<br />
If (i < Y) Then<br />
Me.Location = New Point(X - Me.Width, i + 8)<br />
Else<br />
Timer2.Stop()<br />
Timer2.Enabled = False<br />
Me.Close()<br />
End If<br />
End Sub<br />
<br />
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick<br />
Timer2.Start() ' Here we start Timer2 which handles closing of form<br />
Timer2.Enabled = True<br />
End Sub<br />
End Class
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
see this below code, which is generate a popup form at runtime.
This code from my DLL application ,
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
'===================================================
'
' Module : Atm_rs232_GSMGPRS
' Description : Class for handling RS232 communication with VB.Net 2005 and
' sending SMS and Data Dialing through Serial Port
' Created : 26/04/2007 08:30:00
' Author : Rajesh B ---A poor workman blames his tools---
' Company : Analogics Tech. India Limited. Hyderabad.
''-----------------------------------------------------------------------------------------------
Public Class AnalogicWindows
Public SMSPopupform As New Form
Public SMSPopupPICBOX As New PictureBox
Public analink As New LinkLabel
Public footlbl As New Label
Public popuptext As New Label
Public backcolor1 As New Color
Public backcolor2 As New Color
Private smsimg As Bitmap = New Bitmap(Application.StartupPath & "\images\sms.bmp")
Private portimg As Bitmap = New Bitmap(Application.StartupPath & "\images\port.bmp")
'//////////////////////////////////////////////////
' Method: getlinklabl
' FullName: AnalogicWindows.getlinklabl
' Access: public
' Returns: String)
' Parameter: ByVal popuptextmsg As String
'//////////////////////////////////////////////////
Public Sub getlinklabl(ByVal popuptextmsg As String)
'analink.AutoSize = True
'analink.Font = New System.Drawing.Font("Verdana", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
'analink.LinkColor = System.Drawing.Color.Red
'analink.Location = New System.Drawing.Point(154, 85)
'analink.Name = "LinkLabel1"
'analink.Size = New System.Drawing.Size(224, 17)
'analink.TabIndex = 0
'analink.TabStop = True
'analink.Text = "http://analogicgroup.com"
'analink.BackColor = Color.Transparent
'footlbl.AutoSize = True
'footlbl.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
'footlbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
'footlbl.ForeColor = System.Drawing.Color.White
'footlbl.Location = New System.Drawing.Point(58, 105)
'footlbl.Name = "Label2"
'footlbl.Size = New System.Drawing.Size(192, 16)
'footlbl.TabIndex = 3
'footlbl.Text = "ANALOGIC CAMR Network Server 2.0"
'footlbl.BackColor = Color.Transparent
popuptext.BackColor = Color.Transparent
popuptext.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
popuptext.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
popuptext.ForeColor = System.Drawing.Color.WhiteSmoke
popuptext.Location = New System.Drawing.Point(56, 18)
popuptext.Name = "RichTextBox1"
popuptext.Size = New System.Drawing.Size(210, 57)
popuptext.TabIndex = 4
popuptext.Text = popuptextmsg
End Sub
''SMSPopup Properties
'//////////////////////////////////////////////////
' Method: Generate_SMSPopup
' FullName: AnalogicWindows.Generate_SMSPopup
' Access: public
' Returns: String, ByVal Showtext As String)
' Parameter: ByVal Maintitle As String
' Parameter: ByVal Showtext As String
'//////////////////////////////////////////////////
Public Sub Generate_SMSPopup(ByVal Maintitle As String, ByVal Showtext As String)
Dim octform As Double
Call getlinklabl(Showtext)
backcolor1 = Color.Pink
backcolor1 = Color.LightBlue
SMSPopupform.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
SMSPopupform.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
SMSPopupform.BackColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer))
SMSPopupform.ClientSize = New System.Drawing.Size(350, 130)
SMSPopupform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
SMSPopupform.Location = New System.Drawing.Point(674, 612)
SMSPopupform.Name = "Form1"
SMSPopupform.StartPosition = System.Windows.Forms.FormStartPosition.Manual
SMSPopupform.Text = Maintitle
SMSPopupform.ResumeLayout(False)
SMSPopupform.ShowInTaskbar = False
SMSPopupform.TopMost = True
'' For Picture box
'SMSPopupPICBOX.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
SMSPopupPICBOX.Location = New System.Drawing.Point(1, 0)
SMSPopupPICBOX.Name = "PictureBox1"
SMSPopupPICBOX.Size = New System.Drawing.Size(125, 110)
'SMSPopupPICBOX.Image = newimg.GetThumbnailImage(79, 39, Nothing, Nothing)
SMSPopupPICBOX.Image = smsimg
'SMSPopupPICBOX.Load(Application.StartupPath & "\temp.bmp")
SMSPopupPICBOX.TabStop = False
SMSPopupform.Controls.Add(footlbl)
SMSPopupform.Controls.Add(SMSPopupPICBOX)
SMSPopupform.Controls.Add(analink)
SMSPopupform.Controls.Add(popuptext)
AddHandler SMSPopupform.Paint, AddressOf SMSPopup
SMSPopupform.Show()
For octform = 0 To 100 Step 0.06
SMSPopupform.Opacity = octform / 100
System.Threading.Thread.Sleep(0)
Application.DoEvents()
Next
SMSPopupform.Location = New System.Drawing.Point(674, 612)
Delay(800)
For octform = 100 To 0 Step -0.06
SMSPopupform.Opacity = octform / 100
System.Threading.Thread.Sleep(0)
Application.DoEvents()
Next
SMSPopupform.Hide()
End Sub
''SMSPopup Properties
'//////////////////////////////////////////////////
' Method: Generate_PortPopup
' FullName: AnalogicWindows.Generate_PortPopup
' Access: public
' Returns: String, ByVal Porttext As String)
' Parameter: ByVal Maintitle As String
' Parameter: ByVal Porttext As String
'//////////////////////////////////////////////////
Public Sub Generate_PortPopup(ByVal Maintitle As String, ByVal Porttext As String, ByVal imgtype As Integer)
Dim backBG As Bitmap = New Bitmap(Application.StartupPath & "\images\PopUp-BG.gif")
Dim popuppic As Bitmap
If imgtype = 1 Then
popuppic = New Bitmap(Application.StartupPath & "\images\Cable-detected.gif")
ElseIf imgtype = 2 Then
popuppic = New Bitmap(Application.StartupPath & "\images\CableUnpluged_Anim.gif")
Else
popuppic = New Bitmap(Application.StartupPath & "\images\CableBUSY_anim.gif")
End If
Dim octform As Double
Call getlinklabl(Porttext)
backcolor1 = Color.GreenYellow
backcolor1 = Color.Violet
SMSPopupform.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
SMSPopupform.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
'SMSPopupform.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(128, Byte), Integer))
SMSPopupform.ClientSize = New System.Drawing.Size(300, 94)
SMSPopupform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
SMSPopupform.Location = New System.Drawing.Point(725, 640)
SMSPopupform.Name = "Form1"
SMSPopupform.StartPosition = System.Windows.Forms.FormStartPosition.Manual
SMSPopupform.Text = Maintitle
SMSPopupform.ResumeLayout(False)
SMSPopupform.ShowInTaskbar = False
SMSPopupform.TransparencyKey = System.Drawing.SystemColors.ButtonFace
SMSPopupform.BackgroundImage = backBG
SMSPopupform.TopMost = True
'' For Picture box
'SMSPopupPICBOX.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
SMSPopupPICBOX.Location = New System.Drawing.Point(4, 0)
SMSPopupPICBOX.Name = "PictureBox1"
SMSPopupPICBOX.Size = New System.Drawing.Size(74, 92)
SMSPopupPICBOX.Image = popuppic
SMSPopupPICBOX.TabStop = False
'SMSPopupPICBOX.Image = portimg
'SMSPopupform.Controls.Add(footlbl)
SMSPopupform.Controls.Add(SMSPopupPICBOX)
'SMSPopupform.Controls.Add(analink)
SMSPopupform.Controls.Add(popuptext)
'SMSPopupPICBOX.ImageLocation = Application.StartupPath & "\temp.bmp"
SMSPopupform.Show()
For octform = 0 To 100 Step 0.06
SMSPopupform.Opacity = octform / 100
Application.DoEvents()
Next
SMSPopupform.Location = New System.Drawing.Point(725, 640)
Delay(2000)
For octform = 100 To 0 Step -0.06
SMSPopupform.Opacity = octform / 100
Application.DoEvents()
Next
SMSPopupform.Hide()
End Sub
'//////////////////////////////////////////////////
' Method: SMSPopup
' FullName: AnalogicWindows.SMSPopup
' Access: public
' Returns: Object, ByVal e As System.Windows.Forms.PaintEventArgs)
' Parameter: ByVal sender As Object
' Parameter: ByVal e As System.Windows.Forms.PaintEventArgs
'//////////////////////////////////////////////////
Public Sub SMSPopup(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
Dim mp As GraphicsPath = New GraphicsPath()
Dim myrect As New Rectangle(0, 0, SMSPopupform.Width, SMSPopupform.Height)
Dim c1, c2, c3, c4 As Color
c1 = Color.Black
c2 = Color.Transparent
c3 = backcolor1
c4 = backcolor2
Dim mypenbrush As New LinearGradientBrush(myrect, c1, c2, LinearGradientMode.Vertical)
Dim mybrush As New LinearGradientBrush(myrect, c3, c4, LinearGradientMode.ForwardDiagonal)
Dim mypen As New Pen(mypenbrush, 10)
Dim itpen As New Pen(Color.Transparent)
Dim myfont As New Font("Arial", 25, FontStyle.Bold)
e.Graphics.DrawRectangle(mypen, myrect)
e.Graphics.FillRectangle(mybrush, myrect)
'e.Graphics.DrawImage(PictureBox1.Image, 0, 0)
mp.AddRectangle(myrect)
SMSPopupform.Region = New Region(mp)
End Sub
'//////////////////////////////////////////////////
' Method: graphCalendarDateToXLDate
' FullName: AnalogicWindows.graphCalendarDateToXLDate
' Access: public
' Returns: Double
' Parameter: ByVal year As Integer
' Parameter: ByVal month As Integer
' Parameter: ByVal day As Integer
' Parameter: ByVal hour As Integer
' Parameter: ByVal minute As Integer
' Parameter: ByVal second As Integer
' Parameter: ByVal millisecond As Double
'//////////////////////////////////////////////////
Public Function graphCalendarDateToXLDate(ByVal year As Integer, ByVal month As Integer, ByVal day As Integer, ByVal hour As Integer, ByVal minute As Integer, ByVal second As Integer, ByVal millisecond As Double) As Double
Dim ms As Double = millisecond
graph_NormalizeCalendarDate(year, month, day, hour, minute, second, ms)
Return graph_CalendarDateToXLDate(year, month, day, hour, minute, second, ms)
End Function
End Class
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
One, this post is just too long to be of any use, especially since a bunch of code is commented out. It's too loarge to be of any use as a sample that can be learned from.
Second, SHORTEN YOUR NAME! You don't need "-- A Poor Workman Blames His Tools --" as part of your name. Make it part of your signature instead.
|
|
|
|
|
Dave Kreskowiak wrote: SHORTEN YOUR NAME!
Most irritating thing I have seen today
|
|
|
|
|
I have a pretty big program that I am developing. There are 2 different forms in the program. One of the forms has several panels on it and each panel has a form, or several forms.
I had all of my queries coming from one dataSet but I had problems with conflicting dataTables. Then I created another dataSet for a couple of my list boxes and then it worked. Then I Tried to create 2 different dataSets for one of my panels. One of the dataSets included the database tables and fields that were needed to fill list and combo boxes with info and the other with the profile and schedule info. When I did this suddenly my form is glitchy. When I get the query from the original dataset it works fine, but when I get the query from the new dataset it does not work.
What is the best way to design the datasets for a program to avoid these kinds of problems.
Should I use multiple datasets?
Would it be better for me to use a getData method instead of a fill method instead of using different datasets.
|
|
|
|
|
basically dataset is collection of datatable and it is always better to work with data table in such cases.. so please try to fetch data in minimum number of dataset (possibly one dataset). tehn bind the controls with various datatables...this will work in most cases...
Ashish Sehajpal
|
|
|
|
|
I generally do the opposite of what Ashish recommends. Get each table as data discreet entity (1 table per dataset)
I use 2 types of data, static for lookup lists etc and transactional. The static tables I populate the first time they are used and remain in memory. These are in a class called MasterTables eg
'Local var to hold the table<br />
Private mvApp As DataTable<br />
<br />
'Public property to expose the table<br />
Public Property App() As DataTable<br />
Get<br />
If mvApp Is Nothing Then<br />
mvApp = LoadApp()<br />
End If<br />
Return mvApp<br />
End Get<br />
Set(ByVal Value As DataTable)<br />
'this allows the system to reload the table when the value is nothing<br />
mvApp = Value<br />
End Set<br />
End Property<br />
<br />
Private Function LoadApp() As DataTable<br />
' Load the app table from the database<br />
Dim oClass As New clsApp<br />
Return oClass.GetRecord(cAllRecords)<br />
End Function
Note if you use a dataview to filter a table (when populating a list) then this can be reflected in the base table unless you copy the table.
|
|
|
|
|
I want to Write a program that lists all current installed services (running and stopped),the program should be able to stop/start/Pause/Resume/remove any service. Also the program should display the path of the service executable and its description
How Can i start?
|
|
|
|
|
You can start by reading all of the documentation on the ServiceController class[^]. That means reading all of the docs on all of those properties and methods because you're going to need just about all of them to do this project.
|
|
|
|
|
I am working with vb.net 2005 so there are many function is not exsit in vb.net 2005 as stop() as and start
Ahmed hassan
|
|
|
|
|
My VS2005 knows about ServiceController.Start() and Stop() ...
of course you need to add:
a reference to System.ServiceProcess
and an Imports System.ServiceProcess line
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
What is the best way to store a small amount of data that the user does not have access to? I don't want to have to worry about licensing. Just need to store data from a listbox that is retrieved on startup.
I mainly work with a SQL server 2005 backend that has tens of thousands of entries. I am developing my own app that I would like to distribute.
Mark Thibodeaux
|
|
|
|
|
Your question isn't very clear. Are you saying that this application uses an SQL Server or you application needs one and you're looking for a smallish SQL Server?? Or, are you looking to store a small amount of information somewhere and you want to know the best place to put it??
|
|
|
|
|