|
dear nlarson11,
Thank you for your guidance.
I will try it and revert.
thanks & regards
vinay
|
|
|
|
|
how to backup sqlserver2000 database after sqlclient.sqlconnection made
from vb.net 2005
|
|
|
|
|
MohamedAdam wrote: how to backup sqlserver2000 database after sqlclient.sqlconnection made
Issue a proper TSQL BACKUP[^] command, using the same methods you would for any other SQL statement on your database.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi ,
Iam using SSTAB for my Application in Visual Basic 6.0. Instead of clicking tab for "Selection", I want to select a tab using Mouse over a tabheader.
Please help me...
Thanks & Regards
Kumaran
|
|
|
|
|
kumaran...
i didnt understnd what u r asking... can u make it bit more clear for me? are u asking of selecting a tab just by pausing ur mouse over it?
|
|
|
|
|
Iam asking when we click the tab header only to select the different tabs know. Instead of clicking i want to select the tab when the mouse over of a particular tab headers.
Thanks & Regards
Kumaran
|
|
|
|
|
I wrote two functions to draw something like this.
__ __
_____
__ __
_____
__ __
_____
Have six lines and two kinds.
The Yao fuction draws ____ or __ __ and the DoubleGua one send a string like "010101" to Yao to draw lines.
However, I cannot draw six lines. Only one line show on my form.
Where am I wrong?
Can't this funtion run?
The function is as below:
Public Function DoubleGua(ByVal GuaIndex As String) As Bitmap
Dim Lx As Integer = 7
Dim myBmp As New Bitmap(40, 42)
Dim g As Graphics = Graphics.FromImage(myBmp)
Dim i As Byte
For i = 0 To 5
Dim Lpoint As New Point(Lx * i, 0)
Dim tmpyao As String = GuaIndex.Substring(i, 1)
g.DrawImage(Yao(tmpyao, Color.Black), Lpoint)
Next
Return myBmp
End Function
Public Function Yao(ByVal PorN As String, ByVal _Color As Color) As Bitmap
Dim myBmp As New Bitmap(40, 5)
Dim g As Graphics = Graphics.FromImage(myBmp)
Dim Guabrush As SolidBrush = New SolidBrush(_Color)
Select Case PorN
Case "0"
Dim rects As Rectangle() = {New Rectangle(0, 0, 18, 5), New Rectangle(22, 0, 18, 5)}
g.FillRectangles(Guabrush, rects)
Case "1"
Dim rects As Rectangle() = {New Rectangle(0, 0, 40, 5)}
g.FillRectangles(Guabrush, rects)
End Select
Return myBmp
End Function
|
|
|
|
|
astcws wrote: Dim Lpoint As New Point(Lx * i, 0)
You're offsetting the X coordinate, not the Y. This is drawing each line of your image on the same line, just moved to the right, not down. It should be:
Dim Lpoint As New Point(0, Lx * i)
Also, you MUST Dispose() your Graphics objects after you're done using them. You'll eventually get OutOfMemory exceptions if you don't, and/or you're system will start doing crazy things. If you create the Graphics object, you have the dispose of it. The same is true for Brush's, Pen's, and just about any other object that has a Dispose method.
Public Function Yao(ByVal PorN As String, ByVal _Color As Color) As Bitmap
Dim myBmp As New Bitmap(40, 5)
Dim g As Graphics = Graphics.FromImage(myBmp)
Dim Guabrush As SolidBrush = New SolidBrush(_Color)
Select Case PorN
Case "0"
Dim rects As Rectangle() = {New Rectangle(0, 0, 18, 5), New Rectangle(22, 0, 18, 5)}
g.FillRectangles(Guabrush, rects)
Case "1"
Dim rects As Rectangle() = {New Rectangle(0, 0, 40, 5)}
g.FillRectangles(Guabrush, rects)
End Select
g.Dispose()
Return myBmp
End Function
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Yeah, what a stupid mistake?
As the method "disposed"...I really don't know it before...
Thanks very much.
|
|
|
|
|
Hello,
I am using a for loop to loop through the rows in a datagridview. I am using the index to control the loop. However, the loop always loops an extra time. For example, if i have 10 rows, it will loop 11 times. Is the index the wrong value to use in this case?
For Each dr As DataGridViewRow In Me.dgvPartByCategory.Rows<br />
componentID = Me.dgvPartByCategory.Rows(dr.Index).Cells("PartID").Value<br />
<br />
Next dr
Many thanks,
Steve
|
|
|
|
|
I hope this one will help u........
For Each MainGRD As DataGridItem In Me.dgrdmain.Items
'Use ur code here
Next
Regards,
Magi
|
|
|
|
|
Hi to everybody, The am Italian and The don'ts write very well in English. The have this problem that The don'ts succeed really to resolve: I owe to effect to login on to site and subsequently to donwload HTTP to two pages web that contains burdens information. The don'ts succeed in understanding whether to make the login and to preserve the "LOGON", that is in practice the login doesn't succeed me. The page of the site is : http://www.tre.it:80/selfcare/areaclienti133/4552_infoCosti_ITA_LOGGED.xsl. Thanks thousand and I pray you helped me
seven
|
|
|
|
|
i have appication in that
when i click on "photo" btn it will connect to web cam & after capturing photo by cam i again will go on application.
At that time captured photo will display in picture box
what i do for that
|
|
|
|
|
Google for "vb.net webcam wia"[^] and you'll find lots of resources on how to do this.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi, everyone,
I'm writing a program to discover wireless network
using Windows Native Wifi API & VB.net.
I have to declare the windows API in my VB.net program.
The original windows declaration is as below.
The problem is in "struct _WLAN_AVAILABLE_NETWORK_LIST",
it declared "WLAN_AVAILABLE_NETWORK Network[1];".
I think which means a Network[] array of struct WLAN_AVAILABLE_NETWORK.
But how about the size of the Network[] array?
Is it "1" or more? what does "1" mean?
If I give it the size of 1, then I can get the first network back,
but if I give it more than 1, for example, 10,
then I got an error of "AccessViolationException".
The full message is "Service cannot be started. System.AccessViolationException:
Attempted to read or write protected memory.
This is often an indication that other memory is corrupt."
Actually, the size of the Network[] array is decided by
dwNumberOfItems at run time, which means the size of the
Network[] array is varied-length not fixed, and in most situations
, the size should be more than 1.
I've searched the solution on the internet, and found some similar situations.
They said we should use IntPtr to get the address of the structure array and
then use Marshal class(Marshal.copy(), Marshal.PtrToStructure()....) to get the array,
instead of declared it as a structure array, but they didn't post a sample Marshalling code.
I've tried to code, but still got "AccessViolationException" at Marshalling.
Anyone knows how to solve the problem?
Could you write a sample code for me in VB.net or C# without unsafe code?
Thanks so much. I appreciate your help.
Windows Native Wifi declarations:
'-----function-----
DWORD WINAPI WlanGetAvailableNetworkList(
HANDLE hClientHandle,
const GUID* pInterfaceGuid,
DWORD dwFlags,
PVOID pReserved,
PWLAN_AVAILABLE_NETWORK_LIST* ppAvailableNetworkList
);
'-----structure-----
typedef struct _WLAN_AVAILABLE_NETWORK_LIST {
DWORD dwNumberOfItems; '===>the actual size of array
DWORD dwIndex;
WLAN_AVAILABLE_NETWORK Network[1]; '===>how to declare the array? should I give it fixed size of 1 or change it to an IntPtr
} WLAN_AVAILABLE_NETWORK_LIST, *PWLAN_AVAILABLE_NETWORK_LIST;
typedef struct _WLAN_AVAILABLE_NETWORK {
WCHAR strProfileName[256];
DOT11_SSID dot11Ssid;
DOT11_BSS_TYPE dot11BssType;
ULONG uNumberOfBssids;
BOOL bNetworkConnectable;
WLAN_REASON_CODE wlanNotConnectableReason;
ULONG uNumberOfPhyTypes;
DOT11_PHY_TYPE dot11PhyTypes[8];
BOOL bMorePhyTypes;
WLAN_SIGNAL_QUALITY wlanSignalQuality;
BOOL bSecurityEnabled;
DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm;
DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm;
DWORD dwFlags;
DWORD dwReserved;
} WLAN_AVAILABLE_NETWORK, *PWLAN_AVAILABLE_NETWORK;
typedef struct _DOT11_SSID {
ULONG uSSIDLength;
UCHAR ucSSID[32];
} DOT11_SSID, *PDOT11_SSID;
'-----Enumeration-----
typedef enum _DOT11_BSS_TYPE
{
dot11_BSS_type_infrastructure,
dot11_BSS_type_independent,
dot11_BSS_type_any
}DOT11_BSS_TYPE, *PDOT11_BSS_TYPE;
typedef DWORD WLAN_REASON_CODE, *PWLAN_REASON_CODE;
typedef enum _DOT11_PHY_TYPE
{
dot11_phy_type_unknown,
dot11_phy_type_any,
dot11_phy_type_fhss,
dot11_phy_type_dsss,
dot11_phy_type_irbaseband,
dot11_phy_type_ofdm,
dot11_phy_type_hrdsss,
dot11_phy_type_erp,
dot11_phy_type_IHV_start,
dot11_phy_type_IHV_end
}DOT11_PHY_TYPE, *PDOT11_PHY_TYPE;
typedef enum _DOT11_AUTH_ALGORITHM
{
DOT11_AUTH_ALGO_80211_OPEN,
DOT11_AUTH_ALGO_80211_SHARED_KEY,
DOT11_AUTH_ALGO_WPA,
DOT11_AUTH_ALGO_WPA_PSK,
DOT11_AUTH_ALGO_WPA_NONE,
DOT11_AUTH_ALGO_RSNA,
DOT11_AUTH_ALGO_RSNA_PSK,
DOT11_AUTH_ALGO_IHV_START,
DOT11_AUTH_ALGO_IHV_END
}DOT11_AUTH_ALGORITHM, *PDOT11_AUTH_ALGORITHM;
typedef enum _DOT11_CIPHER_ALGORITHM
{
DOT11_CIPHER_ALGO_NONE,
DOT11_CIPHER_ALGO_WEP40,
DOT11_CIPHER_ALGO_TKIP,
DOT11_CIPHER_ALGO_CCMP,
DOT11_CIPHER_ALGO_WEP104,
DOT11_CIPHER_ALGO_WPA_USE_GROUP,
DOT11_CIPHER_ALGO_RSN_USE_GROUP,
DOT11_CIPHER_ALGO_WEP,
DOT11_CIPHER_ALGO_IHV_START,
DOT11_CIPHER_ALGO_IHV_END
}DOT11_CIPHER_ALGORITHM, *PDOT11_CIPHER_ALGORITHM;
|
|
|
|
|
Hi
I have question about using crystalreport in web browser. I use vb2005 to create crystalreport in default form and then use crystalreportviewver that can show the report in project but when I call from remote(intranet) it always ask " The report you requested requires further information."
and have textbox to fill Server name:,
Database name: ,
User name: ,
Password
[] Use Integrated Security
then have button Logon
but even I fill all data require it still can't open the report.
What I shall do next? thank you for your advice...
Kitty
|
|
|
|
|
try this code:
crpt = New CrystalReport1
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.Password = "xxxx"'databse password
myLogin.ConnectionInfo.UserID = "sa"'Database username
myTable.ApplyLogOnInfo(myLogin)
Next
CrystalReportViewer1.ReportSource = crpt
Magi
|
|
|
|
|
Hello all i am having problem with the stream class, i am new to vb.net. Problem i have is as follows: cannot figure out for the life of me how to get this simple task going, writing using the stream to txt file is replacing the previouse entries instead of adding to the txt file. Next my cboBox is not updating with the info or populating the txt boxes with info from cboBox. I have a cboBox with 1-31 in it(days of month). For each day i need to store some numeric data tied to each day, well not working on mine, or better said dont know how to do it.. Help please..the code is as follows..
<code></code> Option Strict On
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
'Declare module-level variables
Private mblnIsDirty As Boolean
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFecha.SelectedIndexChanged
'Dim test As Integer
'Dim datServicio As New StreamReader("Servicio.txt")
'For test = 1 To 31
' cboFecha.Items.Add(test)
'Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Load the items in teh cboFecha list
Dim dgrResponse As DialogResult
Try
'Open the file
Dim datServicio As New StreamReader("Servicio.txt")
'Read all elements into the list
Do Until datServicio.Peek = -1
cboFecha.Items.Add(datServicio.ReadLine())
txtLibros.Text = datServicio.ReadLine()
txtFolletos.Text = datServicio.ReadLine()
txtHorasH.Text = datServicio.ReadLine()
txtHorasM.Text = datServicio.ReadLine()
txtRev.Text = datServicio.ReadLine()
txtRvsitas.Text = datServicio.ReadLine()
Loop
'Close the file
datServicio.Close()
Catch 'File missing
dgrResponse = MessageBox.Show("Create a new file?", "File not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If dgrResponse = DialogResult.No Then
btnExit_Click(sender, e) 'Exit the program
End If
End Try
txtTotalLibros.Enabled = False
txtTotalFolletos.Enabled = False
txtTotalHorasH.Enabled = False
txtTotalHorasM.Enabled = False
txtTotalRev.Enabled = False
txtTotalRvsitas.Enabled = False
cboFecha.Focus()
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'Save the list box contents in a file
Dim datServicio As New StreamWriter("Servicio.txt") 'Open the file
Dim intIndex As Integer
Dim IntMaximum As Integer
datServicio.WriteLine(cboFecha.SelectedIndex + 1)
'Next intIndex
With cboFecha
If .SelectedIndex <> -1 Then
datServicio.WriteLine(cboFecha.Text)
Else
MessageBox.Show("Select a Day", "No selection made", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End With
datServicio.WriteLine(txtLibros.Text)
datServicio.WriteLine(txtFolletos.Text)
datServicio.WriteLine(txtHorasH.Text)
datServicio.WriteLine(txtHorasM.Text)
datServicio.WriteLine(txtRev.Text)
datServicio.WriteLine(txtRvsitas.Text)
datServicio.Close() 'Close the file
mblnIsDirty = True
'Clears the cbo and txt boxes
cboFecha.Text = ""
txtLibros.Text = ""
txtFolletos.Text = ""
txtHorasH.Text = ""
txtHorasM.Text = ""
txtRev.Text = ""
txtRvsitas.Text = ""
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'Terminates the project
Me.Close()
End Sub
Private Sub btnNewMonth_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewMonth.Click
Dim datServicio As New StreamWriter("Servicio.txt")
'Closes the file
'datServicio.Close()
mblnIsDirty = False
'Opens the file
'Dim datServicio As New StreamWriter("Servicio.txt")
'Erases the Servicio.txt file
datServicio.Flush()
End Sub
End Class <code></code>
Thanks Francisco....
|
|
|
|
|
Hello all i am having problem with the stream class, i am new to vb.net. Problem i have is as follows: cannot figure out for the life of me how to get this simple task going, writing using the stream to txt file is replacing the previouse entries instead of adding to the txt file. Next my cboBox is not updating with the info or populating the txt boxes with info from cboBox. I have a cboBox with 1-31 in it(days of month). For each day i need to store some numeric data tied to each day, well not working on mine, or better said dont know how to do it.. Help please..the code is as follows..
Option Strict On
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
'Declare module-level variables
Private mblnIsDirty As Boolean
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFecha.SelectedIndexChanged
'Dim test As Integer
'Dim datServicio As New StreamReader("Servicio.txt")
'For test = 1 To 31
' cboFecha.Items.Add(test)
'Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Load the items in teh cboFecha list
Dim dgrResponse As DialogResult
Try
'Open the file
Dim datServicio As New StreamReader("Servicio.txt")
'Read all elements into the list
Do Until datServicio.Peek = -1
cboFecha.Items.Add(datServicio.ReadLine())
txtLibros.Text = datServicio.ReadLine()
txtFolletos.Text = datServicio.ReadLine()
txtHorasH.Text = datServicio.ReadLine()
txtHorasM.Text = datServicio.ReadLine()
txtRev.Text = datServicio.ReadLine()
txtRvsitas.Text = datServicio.ReadLine()
Loop
'Close the file
datServicio.Close()
Catch 'File missing
dgrResponse = MessageBox.Show("Create a new file?", "File not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If dgrResponse = DialogResult.No Then
btnExit_Click(sender, e) 'Exit the program
End If
End Try
txtTotalLibros.Enabled = False
txtTotalFolletos.Enabled = False
txtTotalHorasH.Enabled = False
txtTotalHorasM.Enabled = False
txtTotalRev.Enabled = False
txtTotalRvsitas.Enabled = False
cboFecha.Focus()
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'Save the list box contents in a file
Dim datServicio As New StreamWriter("Servicio.txt") 'Open the file
Dim intIndex As Integer
Dim IntMaximum As Integer
datServicio.WriteLine(cboFecha.SelectedIndex + 1)
'Next intIndex
With cboFecha
If .SelectedIndex <> -1 Then
datServicio.WriteLine(cboFecha.Text)
Else
MessageBox.Show("Select a Day", "No selection made", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End With
datServicio.WriteLine(txtLibros.Text)
datServicio.WriteLine(txtFolletos.Text)
datServicio.WriteLine(txtHorasH.Text)
datServicio.WriteLine(txtHorasM.Text)
datServicio.WriteLine(txtRev.Text)
datServicio.WriteLine(txtRvsitas.Text)
datServicio.Close() 'Close the file
mblnIsDirty = True
'Clears the cbo and txt boxes
cboFecha.Text = ""
txtLibros.Text = ""
txtFolletos.Text = ""
txtHorasH.Text = ""
txtHorasM.Text = ""
txtRev.Text = ""
txtRvsitas.Text = ""
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'Terminates the project
Me.Close()
End Sub
Private Sub btnNewMonth_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewMonth.Click
Dim datServicio As New StreamWriter("Servicio.txt")
'Closes the file
'datServicio.Close()
mblnIsDirty = False
'Opens the file
'Dim datServicio As New StreamWriter("Servicio.txt")
'Erases the Servicio.txt file
datServicio.Flush()
End Sub
End Class
Thanks Francisco....
|
|
|
|
|
You didn't open the file for Append, you just opened it and started writing at the beginning of the file. Change your StreamWriter to this:
Dim datServicio As New StreamWriter("Servicio.txt", True) 'Open the file
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Finally it saves in the next lines, Thanks. Now the other problem. How do i get the cboBox going? Is the code in the form load ok, or should i just have code on the cboBox section on it? Or do i need both? CboBox not populating the rest of the txt boxes with correct info...
|
|
|
|
|
From what I've seen in this code, you seriously need to pick up a book on beginning VB.NET. Your logic (not code) skills need work.
The code in FormLoad opens a file and reads a line and populates a textbox with it, reads a line and populates a textbox with it, ..., until the end of the file. The end of file CAN be reached before you populate the last textbox. Also, every time you go though this loop, you replace the text in the textbox that was there on the previous pass!
On top of that, comboboxes don't populate anything. They just let the user pick an item. It's up to you to populate textboxes, which you don't provide the code for in your post. Come to think of it, the SelectItemChanged event for you combobox has all the code in it commented out, plus, it doesn't even describe populating textbox's.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I am new Dave, yes i have a VB.net I got from Junior College by Julia Case Bradley and Anita C. Milspaugh. I have gone through it and they just dont give too much specifics on this stuff, like the simple append Yes you told me, they never even implement it on the sample code they show... All examples they give were the way i had it before. I am trying but with one semester of vb.net, it's not enough to learn data section thats on the second semester, but due to classes being cancelled by them and schedule conflicts with the other ones i have not been able to take the second semester. All the code i have made here is little samples that are on the book and stuff i have found in the internet. As far as the section on the cbobox, i comented it out due to it not working, and besides wanted to get the writer to not overwrite my preveouse input. Yes the idea of this little program is to somehow tie 6 txt boxes i have to the day i select in the cbobox, to be able to select a day in cco and have the txt boxes show what was saved for that day entry... When i get home i will try to post a pic of how the program looks. Thanks for the patience and your helpful postings in this forum. By the way do you know the best vb.net book i can buy that shows exactly the way things are supposed to work not just part of it???
|
|
|
|
|
f_soto wrote: By the way do you know the best vb.net book i can buy
The best book is the one you can understand.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
The three left columns of my datagridview are frozen (pinned?) They don't move with the horizontal scrollbar the way the others do.
Can someone please tell me how they got that way and how to unfreeze them?
Thanks!
|
|
|
|
|