|
can anybody plz tell me how to provide environment similar to Microsoft Excel in VB.net.
for ex :
how to make data entry form in vb.net similar or like excel.
bye
Aakash
|
|
|
|
|
if there is a form in Vb.net then how to disable the close button in that.
and there is one form1 which is starting form of my application and I want to start it maximized . how do I do that ?
plz help
thnx
aakash
|
|
|
|
|
To disable the close button in a form, add this module to your project...
<br />
Option Explicit<br />
Option Private Module<br />
<br />
Public Declare Function GetSystemMenu Lib "user32" _<br />
(ByVal hwnd As Long, _<br />
ByVal bRevert As Long) As Long<br />
<br />
Public Declare Function RemoveMenu Lib "user32" _<br />
(ByVal hMenu As Long, _<br />
ByVal nPosition As Long, _<br />
ByVal wFlags As Long) As Long<br />
<br />
Public Const MF_BYPOSITION = &H400&<br />
<br />
Public Function DisableCloseButton(frm As Form) As Boolean<br />
<br />
Dim lHndSysMenu As Long<br />
Dim lAns1 As Long, lAns2 As Long<br />
<br />
lHndSysMenu = GetSystemMenu(frm.hwnd, 0)<br />
'//remove close button<br />
<br />
lAns1 = RemoveMenu(lHndSysMenu, 6, MF_BYPOSITION)<br />
'
<br />
lAns2 = RemoveMenu(lHndSysMenu, 5, MF_BYPOSITION)<br />
'//Return True if both calls were successful<br />
<br />
DisableCloseButton = (lAns1 <> 0 And lAns2 <> 0)<br />
<br />
End Function<br />
Then in the form_load() event, add this
<br />
Private Sub Form_Load()<br />
Dim retval as boolean<br />
<br />
retval = DisableCloseButton(frmName)<br />
<br />
End Sub<br />
as for starting the form maximized, there should be a property window for the form with an option labeled "WindowState", just set that to "2-Maximized"
or add this to the form_load() event as well
<br />
frmName.WindowState = 2<br />
|
|
|
|
|
Hi,
I am using Mapi session logon method to logon to exchange and sc server.I have to select a profile with which i logon to servers.For this there is a dialog box.On ok click of this box two more boxes appear asking inputs for SC and exchange.
How can i avoid these 3 boxes and still be able to communicate to both the servers and retrieve there infostores.
Thanks in advance,
Amit Gupta
|
|
|
|
|
Hi can someone help me i want to skin my VB.net App can some one show me how i can do this or give me a control that will do it ??
|
|
|
|
|
Hi!
I want to read some information stored in a file.
I mean such as Comment, Title, Author or Keywords.
Are there some APIs that do that ... or must I access the file directly?
Maybe somebody have some code example for me?
Furthermore I want to write (change) this information...
Thanks
Martin
|
|
|
|
|
For MS Office documents, look at Q224351[^]
|
|
|
|
|
i am trying to print word document in VB .net. it is printing the document but it is priting couple of lines of boxes in the beginning. any idea why is doing so. here is the code:
Public Sub PrintDoc()
Dim strPCLPrint As String
strPCLPrint = Trim(lblPCLPrinter.Text.ToString)
'ByVal strDocFile As String
'pcl Print driver
Try
StreamToPrint = New StreamReader("C:\temp\6031044.doc")
Try
Dim pr As New PrinterSettings()
pr.PrinterName = strPCLPrint
MsgBox(pr.PrinterName)
printFont = New Font("Arial", 10)
Dim pd As PrintDocument = New PrintDocument()
'sets the PCL printer for doc printing
AddHandler pd.PrintPage, AddressOf Me.pd_PrintPage
'pd.CreateObjRef()
pd.DocumentName = "C:\temp\6031044.doc"
pd.Print()
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
StreamToPrint.Close()
End Try
Catch ex As Exception
MessageBox.Show("An error occurred printing the file - " + ex.Message)
End Try
End Sub
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As System.Drawing.Printing.PrintPageEventArgs)
Dim lpp As Single = 0
Dim yPos As Single = 0
Dim count As Integer = 0
Dim leftMargin As Single = ev.MarginBounds.Left
Dim topMargin As Single = ev.MarginBounds.Top
Dim line As String
'Work out the number of lines per page
'Use the MarginBounds on the event to do this
lpp = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics)
'Now iterate over the file printing out each line
'NOTE WELL: This assumes that a single line is not wider than the page width
'Check count first so that we don't read line that we won't print
line = StreamToPrint.ReadLine()
While (count < lpp And line <> Nothing)
yPos = topMargin + (count * printFont.GetHeight(ev.Graphics))
'Print Preview control will not work.
ev.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, _
yPos, New StringFormat())
count = count + 1
If (count < lpp) Then
line = StreamToPrint.ReadLine()
End If
End While
'If we have more lines then print another page
If (line <> Nothing) Then
ev.HasMorePages = True
Else
ev.HasMorePages = False
End If
End Sub
Thank you.
Zulfikar Ali
|
|
|
|
|
There is a great example of printing Word Documents to a Fax Device or other specific printer on www.gotdotnet.com. The site is currently down or I would provide you with a direct link.
When it is available again just search for SendMSWordDocumentViaFaxExample.
|
|
|
|
|
How do I create "excel" sheet in MDI (child) window?
|
|
|
|
|
hey,
i'm looking for a good vb or java programmer to code a program which i'm designing the GUI for. Preferably someone in the metro toronto area, and who has experience in designing programs for business. There will be pay involved (you won't be rich but you won't be hungry either) and you'll get to work on a product that will be commercially released.
if you're interested email me at rego.clothiers@sympatico.ca
Paul Rego
p.s. if you are interested, please email me directly coz i may or may not have time to come back here to check the response... I ended up at this site though another link, so I wouldn't normally post a message here.
|
|
|
|
|
I have made several attempts at overriding the backcolor property for a tabcontrol and have gotten no where. Does anyone have any suggestions
|
|
|
|
|
I need to send XML data to a site and receive the processed info.
Can any one suggest me how to go about it ?
Thanks in advance.
VIPUL BHATT
|
|
|
|
|
Try using the M$ XML parser (latest verision is 4.0 I think). If you d/l from M$, comes with both VB and C++ tutorials.
|
|
|
|
|
can anybody tell me how to get value of a textbox of form1.vb into textbox of form2.vb in Vb.net.
ex :
I have two forms form1.vb and form2.vb
both are having one textbox each
then i put some value into textbox of form1.vb
and then I load form2.vb and into that loading event I added
Form2_load()
form2.textbox1.text = form1.textbox1.text
end sub
plz tell me how to do that.
--waiting for a quick reply
Aakash
|
|
|
|
|
drmzunlimited,
Keep in mind there are many ways to do this. When I did this I created two forms, a textbox on each and a button on form1 to invoke this action, the click event of the button looks like this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As String
Dim b As Form2
b = New Form2()
a = Me.TextBox1.Text.ToString
b.TextBox1.Text = a.ToString
b.Show()
End Sub
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
Ok, I have searched and searched everywhere and can find nothing. I am trying to implement my own Collection Classes. However, no matter what I try, I cannot get the "For..Each..Next" syntax to work. Evertime it tries to access it (For Each User in UsersCollection), it gives me an 'System.InvalidCastException' error.
Aside from creating Strongly Typed Collection Classes, does anyone know how this can be implemented?
|
|
|
|
|
Tim McCurdy wrote:
it tries to access it (For Each User in UsersCollection), it gives me an 'System.InvalidCastException' error.
Does your class implement IEnumerable Interface? What is wrong with using an ArrayList object?
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
Hello again,
C has a function called 'strpbrk,' which stands for string point break. The function takes two arguments. First arg is the string I want to search. The second arg is a string of characters that I want to check for. If any of the characters contained in the second string are in the first string the function returns a pointer to the element in the array where the character was located.
Basically, if none of the characters in the second set are found in the first set, the function returns NULL (or zero, if you will).
Does VB have a function that performs this same operation?
my func:
[source]
' forgive my C-speak
if strpbrk( "HELP ME, PLEASE!", " SXPT" )
//character ' ' found (space)
// do something
printf("Characters found in set!");
else
//characters in second set NOT found in first set
// do something else
printf("Characters NOT found in set!");
[/source]
or
Do I have to use an array and scroll through the entire array to accomplish this?
Thanks in advance,
Like2Byte
|
|
|
|
|
|
Thanks,
here's what I did.
dim c as string
dim s as string
dim i as long
s = "really long string really long string really long string..."
for i = 1 to len(s)
c = mid$(s, i, 1)
select case asc(c)
case 1 to 127
' do stuff
end case
next
|
|
|
|
|
If you're using VB.NET, you can use the IndexOfAny method of the String :
C#:
string s1 = "HELP ME, PLEASE!";
string s2 = " SXPT";
int i = s1.IndexOfAny(s2.ToCharArray());
if (i == -1)
Console.WriteLine("Characters not found!");
else
Console.WriteLine("Characters found at position {0}", i);
VB.NET:
Dim s1 As String = "HELP ME, PLEASE!"
Dim s2 As String = " SXPT"
Dim i As Integer = s1.IndexOfAny(s2.ToCharArray())
If i = -1 Then
Console.WriteLine("Characters not found!")
Else
Console.WriteLine("Characters found at position {0}", i)
End If
In VB6, you would have to fake it:
Dim s1 As String : s1 = "HELP ME, PLEASE!"
Dim s2 As String : s2 = " SXPT"
Dim i As Integer
Dim index As Integer
Dim found As Boolean : found = False
For i = 1 To Len(s2)
index = InStr(1, s1, Mid(s2, i, 1)
If index > 0 Then
found = True
Exit For
End If
Next
If Not found Then
Debug.Print "Characters not found!"
Else
Debug.Print "Characters found at position " & index
End If
|
|
|
|
|
I'm not sure if I made myself clear last time so i'll try to be more succint.
Is it possible to copy a control along with it's code on a excel spreadsheet so that you end up with two or more controls utilising the same code as a foundation, but having different identifiers and operating on different data? Would this require the creation of a macro within visual basic to make a copy of the code within the development environment or is there another way?
Pls help!
|
|
|
|
|
Chris Hooper wrote:
Is it possible to copy a control along with it's code on a excel spreadsheet so that you end up with two or more controls utilising the same code as a foundation, but having different identifiers and operating on different data?
No
Chris Hooper wrote:
Would this require the creation of a macro within visual basic to make a copy of the code within the development environment
Yes
Succint questions, succint answers
My latest articles:
XOR tricks for RAID data protection
Win32 process suspend/resume tool
|
|
|
|
|
Are you *sure* about this. Take a quick look at this post on a different board relating to a similar problem. It appears to me that the same code is being used to access multiple controls independently....
http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=2&MsgID=120530&Setting=A9999F0001
|
|
|
|