|
i dont quite understand what i need to do.
|
|
|
|
|
Hi All,
I have a table (tblEmp) from which I am exporting data to a excel sheet.The table contains 5 fields(empid,empname,age,address,accountno)
Issue:
Now I want that when ever I export the data from tblEmp table , the accountno field should come as **** in the excel sheet
Please let me know how can I do this by vb.net.
Thanks in advance.
Pradip Kishore
|
|
|
|
|
AFIAK, there is no built in way to do that. You could do a for each on the string char array, and replace each char with an asterisk. Also, you could take a look at the getpass module. And there is always google, for such a simple problem.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Sorry if this is the wrong place. I did not see a seperate VBA forum.
I am trying to launch a seperate process in an Outlook VBA script.
System.Diagnostic.Process is not recognised.
Any Ideas?
I would like to read the output from the launched process.
Thanks in Advance,
WT
|
|
|
|
|
Hi i'm looking for a way that can allow me to control the left button of the mouse .
for example : how to make the mouse to be pressed when i click on the button enter
Thank you
|
|
|
|
|
Your question is rather vague, so I'll do a little guess work: You have a windows application that does something when you click the left mouse button anywhere on the window or on a specific control. This application is run in an environment with a cat, which is not being fed enough. So on a regular basis you are forced to press the enter key on your keyboard instead of clicking the left mouse button.
Generally speaking the answer is quite simple: get rid of the cat. But seriously, put the code that you want to execute, when normally you press the left mouse button, in its own sub or function, and then instead of writing this same code directly under the mouse button click event, you only call the sub or function. Same thing with the KeyPress event, except that you may first have to check that the button pressed is actually the enter key (If e.KeyChar = Chr(13) Then ). As a result you only have to write the code once, and you can make pretty much any event execute it.
If this isn't at all what you meant, then I suggest being more specific, otherwise I hope it helps.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi,
I'm building a data exchange app using sockets, using asynchronous sockets one app listens for incoming connections, and the other one connects to the first and sends some data to the other.
The code for the listener app:
Private Sub startListening()
Dim iphostinfo As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName())
Dim localEP As New IPEndPoint(iphostinfo.AddressList(0), 8000)
listener = New Socket(localEP.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
Try
listener.Bind(localEP)
listener.Listen(5)
listener.BeginAccept(New AsyncCallback(AddressOf acceptCallback), listener) 'Pocni asinkrono primat nadolazece podatke
While True
If abort = True Then
cleanUp()
Application.Exit()
End If
Application.DoEvents()
End While
Catch ex As Exception
End Try
End Sub
Private Sub acceptCallback(ByVal ar As IAsyncResult)
Try
listener.EndAccept(ar)
RaiseEvent status("Konekcija uspostavljena")
Application.DoEvents()
timeout.Stop()
timeout.Enabled = False
'Velicina Buffera
Dim bytes(1024) As Byte
listener.BeginReceive(bytes, 0, bytes.Length, SocketFlags.None, AddressOf receiveCallback, bytes) ' HERE IT CRASHES : the error is written bellow
Catch ex As Exception
RaiseEvent status(ex.Message)
Application.DoEvents()
End Try
End Sub
Private Sub receiveCallback(ByVal ar As IAsyncResult)
Dim bytes() As Byte = CType(ar.AsyncState, Byte())
Dim numBytes As Int32 = listener.EndReceive(ar)
If numBytes = 0 Then 'Ako nema više podataka onda iskljuci socket i spremi dobiveni file
listener.Shutdown(SocketShutdown.Both)
listener.Close()
spremiFile(data)
Else
If prviPodatak = False Then
ReDim Preserve data(data.Length + 1024)
prviPodatak = False
End If
prviPodatak = False
Array.Copy(bytes, 0, data, data.Length, bytes.Length)
'--Ocisti buffer
Array.Clear(bytes, 0, bytes.Length)
'-- Opet pocni primat podatke
listener.BeginReceive(bytes, 0, bytes.Length, SocketFlags.None, AddressOf receiveCallback, bytes)
End If
End Sub
You will see a comment in the code where it crashes. The apps conenct to each other but when it's time to beginReceive (marked in the code) it crashes with the error:
"A request to send or receive data was disallowed because the socket is not connected and(when sending on a datagram socket using a sendTo call)no address was supplied.
Any clues?
The server part (the part that sends data)
Private Function salji(ByVal port As Integer, ByVal data() As Byte, ByVal ipAdresa As String) As Boolean
Dim addr As IPAddress = Dns.GetHostEntry(ipAdresa).AddressList(0)
If Not addr Is Nothing Then
Dim ep As New IPEndPoint(addr, port)
cSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
cSocket.BeginConnect(ep, AddressOf connectCallback, Nothing)
End If
Do
If spoj = stateConn.nijeSpojen Then
ElseIf spoj = stateConn.greska Then
Return False
Else
cSocket.Send(data)
Return True
End If
Loop
End Function
Private Sub connectCallback(ByVal ar As IAsyncResult)
Try
cSocket.EndConnect(ar) ' It passes this part and exits the subs like everything is OK . There is no error on this part only on the listener part (of course, when it tries to send data it can't bacause there is an error in the listening app)
spoj = stateConn.spojen
Catch ex As Exception
spoj = stateConn.greska
End Try
End Sub
Before this I tried Synchronous method. And it works. But for many reasons It must be asynchronous.
Any help greatly appreciated,
Thank you!
|
|
|
|
|
Plz anybody knows hot to store images in my.settings
i tried several settings types but nones takes the byte() or image data format
plz any help?
phatkin
|
|
|
|
|
Hi,
For what purpose will the images be used? You can store the images as part of an embedded resource (resx) file, or if you are dealing with a very small number of images, they can be added directly to the project and embedded and then accessed via reflection.
Clean code is the key to happiness.
|
|
|
|
|
I want to be able to change the images programmatically
The images are the company's logo and they can change it anytime
Thanks
phatkin
|
|
|
|
|
Why do you not store the path to the image file rather than the image itself?
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
I'm using ASP.Net 2.0. I need to show data from a single field (as a
hyperlink) but the column is to be repeated (RepeatColumns = 2). I have
this in a DataList control and it is working fine. There is an additional requirement now to add a pager control, but it seems like I would have to use a GridView instead of a DataList in order to allow paging. The GridView doesn't have the capability to repeat columns however.
|
|
|
|
|
I want to check whether folder exists or not in a particular path from my code.
If anyone has experience about how to check (eg . function ), pls tell me.
phoo pwint
flowerppk
|
|
|
|
|
If System.IO.Directory.Exists("C:\Example") = True Then<br />
' do whatever '<br />
End If
|
|
|
|
|
In my Application have one DataGridView tool in that tool have 6 Column
1st Column is DataGridViewButtonColumn
2nd is DataGridViewTextBoxColumn
3rd is DataGridViewComboBoxColumn
4th is DataGridViewTextBoxColumn
5th and 6th is DataGridViewCheckBoxColumn
My need is:
5th Column is Checked then current row is selected and current row back color are change if unchecked don’t change current row in this change only 5th Column DataGridViewCheckBoxColumn is Checked, if I checked
6th Column DataGridViewCheckBoxColumn Don’t change Current row
I create that kind of Data Grid and my code is work as check any Checkbox Column (5th and 6th) select current row and back color is chance but I uncheck that column not chance current row. In this task, work as fifth Column only but my code work fifth and sixth column also
it is Urgent
Thank You
Franics K Antony
modified on Monday, January 28, 2008 8:48:54 AM
|
|
|
|
|
Hi all,
I hv coded a function to convert a string to a particular DateFormat. It works well good.But when I pass the dt as 25-12-2007 , I am
getting the error as
Message "The string was not recognized as a valid DateTime. There is a unknown word starting at index 0." String
Function
Public Shared Function DisplayFormatedDate(ByVal dt As String, ByVal strDateStringValue As String) As String
Try
Dim dttemp As String
Dim strFormat As String = strDateStringValue.Trim
strFormat = strFormat.Replace("mm", "MM")
If Len(dt) > 0 Then
'dttemp = Date.Parse(dt).ToString(strFormat)
dttemp = Convert.ToDateTime(dt).Parse(strFormat).ToString
End If
Return dttemp
Catch ex As Exception
End Try
End Function
|
|
|
|
|
Replace
dttemp = Convert.ToDateTime(dt).Parse(strFormat).ToString
with
dttemp = Convert.ToDateTime(dt).ToString(strFormat)
VB Prog
|
|
|
|
|
hi all
their is a richtextbox in my application that shows some text, also their is a print button to print the text of the richtextbox. my requirement is that i don't want to allow user to create pdf through virtual printer.
i tried to restrict the virtual printer to show in the printer list but that could not be done.
does some one has any idea then please tell me
thanks in advance
help everyone
Falling down is not defeat...defeat is when u refuse to get up...
|
|
|
|
|
Although I am not sure how you would have to go about it, you could for example program your app to only use the default printer and/or devise a method to check whether a printer is virtual or real. If it is real allow printing, and if not then disallow.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi,
I have a form application (Form1) with contol1 (a Label) as an added control of control2(a panel) I tried to process the mousedown event in control2 when mousedown happens in control1.
I tried to use code like this
Label_click(...) handles control1.mousedown
RaiseEvent control2.mousedown(...)
it wont compile.. ;(
Any idea on how to do it?
Or even better, how to make control1 transprent of any event (possible?) so that control2 will directly see the mousedown event.
Is there any good book or tutorials talk about events handling?
Thanks a lot.
|
|
|
|
|
Why don't you just call the hanlder (or even better the sub/function doing your stuff) directly instead of trying to fire the event itself?
This is the way I normaly do this:
Write functions/subs to do your stuff.
In the eventhandlers just call those functions (a benefit of this is that you can implement your events with AddHandler and a anonymous function if you like - of couse you can do this anyway but the AddHandler line / block will get very crowded if you code everything there).
|
|
|
|
|
I need to modify the sizes of other controls in the panel based on the mousemove event. I think the mousemove events only provide the client coordinates, i.e. the coordinate inside control1, if the event is handled in the label. So I need to convert the coordinate, right? or there are better ways to do it?
More specific, I am doing width-resziable labels in the panel. I try to resize the label width with mouse... just like resize the colume within a table.
Thanks
|
|
|
|
|
I needed to make a change to the size of a field in an access database so that it would store a path to an image. The field was a text field with a size of 50...I changed it to size of 255 which is the max.
So now I cannot figure out what I need to update in my program so that it will pick up the new field size change. I keep getting an error that says I am violating the maxlength limit of the column.
Any suggestions?
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Did you save the change? Have you confirmed that the access database has the new size?
When you change the data structure, the code will automatically pick up the change, as long as you rerun the program and the connection is recreated.
Also, I would check the length of the path, which you are trying to save in the database.
VB Prog
|
|
|
|
|
In my VB.net application I want to make sure that only one instance of application is running at a time on a client computer. Furthermore I want to perform following tasks:
1. My application should accept a command line argument (Customer Id).
2. Pass this argument to already running instance of the application.
3. Search and load customer data from database and display the respected form in the existing instance.
I have managed to restrict multiple instance by using Process object and easily accepted command line arguments by using My.Application.CommandLineArgs collection.
Public Sub Main()
Dim tempProcess As Process
tempProcess = checkInstance() ' A function which validates current process
If tempProcess Is Nothing Then
Application.Run(New frmWelcome)
Else
Dim hwnd As Int32
hwnd = tempProcess.MainWindowHandle.ToInt32
Try
If hwnd > 0 Then
If IsWindowVisible(hwnd) = False Then
ShowWindowAsync(hwnd, ShowWindowConstants.SW_MAXIMIZE)
End If
SwitchToThisWindow(hwnd, True)
SetForegroundWindow(hwnd)
SetActiveWindow(hwnd)
LoadContact() 'A function which extracts command line argument and call a function from existing running instance.
Application.Exit()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
When I call a function from existing instance I get an error 'Unable to create window handle'.
Basically I am not an experienced VB.Net programmer, I will appreciate if someone have a look into it and help me out. I will be very thankful if someone pass me an example.
Many thanks
Nas
|
|
|
|