|
You can use ILMerge[^] to combine compiled .Net assemblies. Its a command line program so you can just load up cmd and run something similar to the following (as long as ILMerge.exe is somewhere in your PATH):
ilmerge /out:MyExe.exe MainAssembly.exe ReferencedDll1.dll ReferencedDll2.dll That will combine MainAssembly.exe , ReferencedDll1.dll and ReferencedDll2.dll into a stand alone exe called MyExe.exe . This exe can then be distributed on its own.
Hope this helps
Cheers,
Will H
|
|
|
|
|
|
Im using Visual Basic 6.0 and facing a problem...an error message occurs
Run Time Error : 402
must close/hide modal form
This error occurs sometimes when I use to save some record on a modal form...If I close the error message application would be closed.
Plz help me to trace out this problem...what could be the reason behind it.
Thanx in advance
Noshaba Mariam
|
|
|
|
|
You're trying to close a Modal form that isn't at the top of the z-order. In other words, You have a form that opened a modal form, that itself, opened a modal form. You have to close the forms in the reverse order that you opened them.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thnx for the help ... Now I have bcome able to solve my problem...
Noshaba
|
|
|
|
|
how can i set the session for my login page that no one is able to access the page directly.he/she must login first.
|
|
|
|
|
I think you are dealing with ASP or PHP related to a web site. If you do so, here is my advice:
You have to control every entry related to admnistration to your web site. It is likely create a sub procedure and check the session variable if it has a initiated value.
Sub Check_Security()
' check if someone is trying to get in the pages by directly typing the
' page name
If Session("Log_UserID") = "" OR Session("Log_MemberType") <> "admin" Then
response.redirect ("../quit.asp")
End if
End Sub
Check_Security() procedure should be in every asp or php (admin) related web pages (on top of the page). The example above shows how to control a user if he or she is a admin... You can change it vice versa...
I hopw that works out for you !
|
|
|
|
|
In my VS2003 project I send mail and it sends 7-8 times every time I send it?
I have the following code in my global.asax code, The problem is the receiver gets 7-8 copies every time i SEND IT?
Public Class Global
Inherits System.Web.HttpApplication
#Region " Component Designer Generated Code "
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
'1. Create a connection
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
myConnection.Open()
'2. Create the command object, for the query
Const strSQL As String = "Select LastUpdated, ProductId from products "
Dim objCmd As New SqlCommand(strSQL, myConnection)
Dim objDR As SqlDataReader
Dim att
objDR = objCmd.ExecuteReader()
While (objDR.Read)
If (Not (objDR("LastUpdated") Is DBNull.Value)) Then
If (Date.Compare(objDR("LastUpdated"), Today.Date) = 0) Then
Dim newMail As New MailMessage
newMail.From = "zzzxyz@msn.com" '' this is the From Address
newMail.To = "bill@msn.com" '' this is TO Address
'newMail.Cc = "ken@dtyinc.net" '' this is TO Address
newMail.Subject = "Change in Product Rate"
newMail.Body = " Dear Ken, " & "Please review attached document for product ID: " & objDR("ProductID") & "Thank you," & "Kenn()"
att = New MailAttachment("C:\Inetpub\wwwroot\GrocerToGo\Product_Changed.doc")
newMail.Attachments.Add(att)
newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "bill@dtyinc.net")
newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "Password")
SmtpMail.SmtpServer = ""
SmtpMail.Send(newMail)
End If
End If
End While
myConnection.Close() 'Close the connection
End Sub
|
|
|
|
|
In my Global asax file aDo I need the code below newmail.fields.add and why do I need them?
The first one works but it puts my password in the code.
I am using IIS smtp mail and VS 2003
Also noted below, I have an outlook email account (the first one below password and name changed )
and a msn.com email account
The outlook email account works but the msn account does not?
newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
'newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "kenn@dtyinc.net")
'newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "Password")
'SmtpMail.SmtpServer = "mailserver"
SmtpMail.SmtpServer = ""
newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
'newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "kenn@msn.com")
'newMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "welcome")
'SmtpMail.SmtpServer = "mailserver"
SmtpMail.SmtpServer = ""
|
|
|
|
|
when i execute following code then it save two record instead of one.....
Imports System.Data
Imports System.Data.Odbc
Partial Class Category
Inherits System.Web.UI.Page
Public x As Integer
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ConnStr As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=AgentImg;uid=root;pwd=;option=3"
Dim con As OdbcConnection = New OdbcConnection(ConnStr)
Dim str1 As String
Dim ad As OdbcDataAdapter = New OdbcDataAdapter()
If (Option1.Items(1).Value = 1) Then
str = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '" & TextBox2.Text & "','" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
Else
str = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '' ,'" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
End If
Dim InsCom As OdbcCommand = New OdbcCommand(str1, con)
con.Open()
InsCom.ExecuteNonQuery()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
con.Close()
End Sub
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Option1.SelectedIndexChanged
If (Option1.Items(0).Selected = True) Then
x = 1
TextBox2.Enabled = True
End If
If (Option1.Items(1).Selected = True) Then
x = 2
TextBox2.Enabled = False
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
i have set the autopostback property true of optionlist1.
please give the suggstion.
|
|
|
|
|
Where do you declare the variable str, and what value do you put in it?
---
b { font-weight: normal; }
|
|
|
|
|
i have declare the str variable in the local module that is in button
click(). i'm storing the sql query in the str variable.
|
|
|
|
|
Where do you set the value of str1, then, that you are using in the command object? Please show all relevant code.
---
b { font-weight: normal; }
|
|
|
|
|
Imports System.Data
Imports System.Data.Odbc
Partial Class Category
Inherits System.Web.UI.Page
Public x As Integer
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ConnStr As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=AgentImg;uid=root;pwd=;option=3"
Dim con As OdbcConnection = New OdbcConnection(ConnStr)
'Dim InsCom As OdbcCommand = New OdbcCommand(str, con)
'con.Open()
'Dim str As String = "insert into Category(Name,address,age,city) values('"&Name&"','"&Address&"','"&Age&"','"&City&"')"
'sqlCmd.CommandText = str
'sqlCmd.CommandType = CommandType.Text
'sqlCmd.Connection = con
'sqlCmd.ExecuteNonQuery()
Dim str1 As String
Dim ad As OdbcDataAdapter = New OdbcDataAdapter()
str1 = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '" & TextBox2.Text & "','" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
'If (Option1.Items(1).Value = 1) Then
'str = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '" & TextBox2.Text & "','" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
'Else
'str = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '' ,'" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
' End If
'If (Option1.Items(1).Selected = True) Then
'Dim str As String = "insert into Category values('',@Category_Name,'',@Category_Desc)"
Dim InsCom As OdbcCommand = New OdbcCommand(str1, con)
If Not FileUpload1.PostedFile Is Nothing And FileUpload1.PostedFile.ContentLength > 0 Then
Dim fn As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
Dim SaveLocation As String = Server.MapPath("images") & "\" & fn
Try
FileUpload1.PostedFile.SaveAs(SaveLocation)
Catch Exc As Exception
'Response.Write("Error: " & Exc.Message)
End Try
Else
Response.Write("Please select a file to upload.")
End If
'Dim str As String = "insert into names values(@Name,@Addres,@Age,@City)"
'Dim str As String = "insert into Category(@id,@Category_Name,@Category_Img,@Category_Desc)"
'con.Open()
con.Open()
InsCom.ExecuteNonQuery()
'ExecuteNonQuery()
'MsgBox("insert into Category values('2',@Category_Name,'',@Category_Desc)")
'InsCom.ExecuteReader()
' GridView1.DataSource = InsCom.ExecuteReader()
'GridView1.DataBind()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
con.Close()
End Sub
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Option1.SelectedIndexChanged
If (Option1.Items(0).Selected = True) Then
' x = 1
TextBox2.Enabled = True
End If
If (Option1.Items(1).Selected = True) Then
x = 2
TextBox2.Enabled = False
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Page.IsPostBack = False) Then
x = 1
End If
End Sub
End Class
|
|
|
|
|
That's better, now the code looks like it's possible to run.
The code in the event seems to be correct. Do the records that are added in the database contain the same information, or is the second record mostly empty? The later would suggest that the event is executed twice.
Write something to the page from the event, so that you see if it is called twice.
---
b { font-weight: normal; }
|
|
|
|
|
I want to display the data in datagrid and using sqlconnection with ado.
What is the code for that.
and is there any difference b/w datagrid and Flex data grid control
|
|
|
|
|
1.make sqladapter object.
2.pass the connstr,on in it.
3.set the datasource property of datagrid.
4.bind the datagrid
|
|
|
|
|
What are the commonly asked questions in the interviews in vb.net for the fresher.
|
|
|
|
|
Not a comprehensive list, but a start.
You really should look at some employment agencies in your country too. Get to know the recruitment people and they can provide some assistance.
1. How many years experience do you have?
2. What is your highest academic qualification?
3. What is the difference between a Class and a Module?
4. Do you play football/soccer/cricket/paintball/drive go-karts/etc...?
5. Why should you not use global variables?
6. When, if ever, should you force the garbage collection to run?
7. In OO terminology, what does 'encapsulation' mean?
8. How would you test a new assembly?
9. If you have a programming question, where would you look for help and in which order...
a. Visual Studio Help
b. MSDN website
c. Google search
d. Your workmates
e. The Code Project
f. all of the above in that order
10. Do you comment all your code? (Honestly?)
11. Why should you be considered for this job? (i.e. what benefit can you bring to the company)
However, the most important one I ask potential candidates is:
12. Are you a TEAM PLAYER?
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Steve Pullan wrote: 12. Are you a TEAM PLAYER?
Oooohhhhh, I LOVE this one. In my experience, this means "Will you accept everything we say as gospel and not question anything we tell you or do to you?" Even way past the point where they cut your paycheck for doing outstanding work and give themselves raises afterward.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave, yep I agree that's the way it could work - I have fallen foul of this too in the past, but I'm approaching it purely from a devloper's perspective (I'm not a manager) where pro-active teamwork is highly valued.
Among other things I've had guys metaphorically lock themselves in a closet and never interact with the rest of the team. When code review time comes along they take every fault found as a personal insult and invariably we find that their code has also diverged from the project scope considerably.
My philosophy is that it is not my code nor your code - all code is our code. (ego-less programming, the reference escapes me ATM) That way we all reap the rewards of our efforts.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
hi all, i'm doing my project in VB.NET using SQL server as backend. I need a code to do the following
1. i got a form where in user types his userid
2. based upon the userid, the crystal report should have fields containing info abt that particular user (the details which already stored in DB)
Please Help me.....
|
|
|
|
|
can anyone show me how to update a access database using vb .net?
to be more clear, i have an access database call "databasename.mdb",and the table is named "prduct" when the user select from the combobox matching column1, column2's value will show in the textbox ready to be modify, when seavebutton click the text in textbox will update to column2.
i know how to do connect and read from the database only updating need help! thanks for your time!
|
|
|
|
|
You can use
Me.yourTableAdapter.Update(Me.yourDataBaseDataSet.yourTable)
Just as you load data
Me.yourTableAdapter.Fill(Me.yourDataBaseDataSet.yourTable)
and check whether you have created the primary key
Regards,
Chatura Dilan
|
|
|
|
|
do you mean this?
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=""c:\databasename.mdb"";"
Dim objConn As New OleDb.OleDbConnection(connectionString)
objConn.Open()
Dim ds As New DataSet
Dim da2 As OleDb.OleDbDataAdapter
Dim sql As String
sql = "SELECT [Name] FROM Developer"
da2 = New OleDb.OleDbDataAdapter(sql, objConn)
da2.Fill(ds, "Developer")
Dim cb As New OleDb.OleDbCommandBuilder(da2)
ds.Tables("Developer").Rows(0).Item(0) = "yes"
da2.Update(ds, "Developer")
but it give me an "Invalid Operation Exception" ---"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."
can anyone tell me why?
p.s. do i have to created the primary key? why do i have to check?
|
|
|
|
|