|
Hello,
Dim obj As New Microsoft.Win32.RegistryKey
I could not create a new object of Registrykey.This class is a encapsulation method
I got the error( Overload resolution failed because no 'New' is accessible).How can I develop this type class.Please help me
Continue...
|
|
|
|
|
If you're trying to create a new subkey in the registry, you're doing it wrong. Registry and RegistryKey are essentially class factories that create and return new RegistryKey objects.
Dim myNewKey As RegistryKey = Registry.LocalMachine.CreateSubKey("mySubKey")
This will open the Local Machine hive, create a new subkey off of the root of Local Machine, then return the RegistryKey object representing the new subkey.
You can the use that object to create values in the new key.
myNewKey.SetValue("valueName", value)
' Don't forget to Flush! ;) This forces the Registry to commit changes to disk immediately.
' You don't have to call Flush if waiting for the lazy flusher to commit to disk is OK.
myNewKey.Flush()
' You do have to call Close when you done reading/making changes.
myNewKey.Close()
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Free Visual Basic.NET videos at http://www.vbdotnet.somee.com
please reply for any ideas or comments
|
|
|
|
|
Hi, I need to build an application which will send the large picture (around 800kb) via an e-mail using dial up networking connection. I want to send the data very fast in order to reduce total cose and reduce time consuming. Does any one know how to use any method to send a graphic file over an internet by using a slow connection? Does the graphic need to convert to any data type before send over an internet?
|
|
|
|
|
Theres nothing special about sending an email down a slow write compared to sending it over broadband.
If you want to reduce the bytes sent for this picture, and thus speed up sending it, you're going to have to sacrifice something to do it. This is usually the image size and/or quality.
Reducing the dimensions (size) of the image will quickly take care of the problem, but now the recipient has a much smaller picture to look at.
Re-encoding an image to a .JPG image, like converting a .BMP image to a .JPG, will also reduce the size (in bytes) of the image, but it also sacrifices image quality. If the image is already a .JPG, you'll have to specify a higher compression when you convert the image to another .JPG file, thus further sacrificing image quality.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Are there any possible way to convert an image to any format (example: a small text code format) and send over an e-mail then rebuild the picture after it arrive at its destination?
|
|
|
|
|
Converting the byte stream to a Base64 encoded text, but this will actually make the file BIGGER. There is no way to convert it to a smaller number of bytes without sacrificing something.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi I have a file that has come form a UNIX machine, which I believe was part of a database! What I would like to do is convert it to a plain text file, the file itself is readable but has a lot of non-standard characters which I need to strip out, can this be done, here is a small sample of the file
1206051101_P2E2880 OOW03313P 2011CHRX DARTFD S EMU 0000124659005 090D SE_________ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ_______
ÿÿÿÿÿÿÿÿ0706052258_P2E3080 OOW03315P 2041CHRX DARTFD S EMU 0000124659005 090D SE_________ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ___
____ÿÿÿÿÿÿÿÿ0706052258_P2E3480 OOW03321P 2141CHRX DARTFD S EMU 0000124659005 090D SE_________ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ_______ ÿÿÿÿÿÿÿÿ
The parts that I’m interested in reading is OOW03315P 2041CHRX DARTFD S EMU, P2E3480 OOW03321P 2141CHRX DARTFD S EMU etc and removing the rest can this be done?
Cheers for any info
Darren
|
|
|
|
|
If you have an interest in only digits, letters, and whitespace, then the following code should do what you want:
' sourcePath is your source file.
' destPath is your destination file.
Dim sr As System.IO.StreamReader = System.IO.File.OpenText(sourcePath)
Dim s As String = sr.ReadToEnd()
sr.Close()
Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder(s.Length)
Dim i As Integer
For i = 0 To s.Length - 1
If Char.IsLetterOrDigit(s.Chars(i)) OrElse Char.IsWhiteSpace(s.Chars(i)) Then
sb.Append(s.Chars(i))
End If
Next
Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter(destPath)
sw.Write(sb.ToString())
sw.Close()
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thank You, Works a treat...
Darren
|
|
|
|
|
|
The best thing to do is invest some time in regular expressions. You'll get much better results and not get any hard-to-locate cases where your changes destroyed or modified good data.
Andrew Peters
Fabrefactum Software
|
|
|
|
|
Hello
I wrote a form-based VB.NET application that also updates registy, uses 'common file-open dialog' and more.
It works perfectly.
The Problem:
When i run the exe file from another computer in the network, I get many security permission exceptions.
I get them when i try to :
* deal with registry
* when i access the common-dialog
* EVEN when i use 'END' statement to shut the application !
It can be solved by setting local .net framework security permissions on each computer. but im not satisfied with this solution. Is there any other solution in the programming-level??
Thanks ahead for an answer.
Uri
|
|
|
|
|
There is no programmatic way to get the permissions, since code running from a network source is not trusted. You MUST set this up either on each machine, or by using Group Policies in a domain environment.
Chapter 8 – Code Access Security in Practice[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What we do is to Create a standard .snk file and, you have a utility to create it aai believe it is called sn.exe run from the command line and get help to see how to use. Then I sign my assembilies with it look in the assembly.cs(.vb) file and add the location of your .snk file.
Now you can use the .NET configuration tool from start menu and tell your computer to trust applications that are signed with this key pair.
Use the same snk file for all your apps and the users would only have to set trust once. We had a programmmer that created MSI file that updated the Machine.config file to make it easier to set this trust policy. I could ony offer that we did that but I have no idea what the code looks like.
|
|
|
|
|
currently i'm doing my project and the title is SMS Voting that using VB to code.
The system operate :-
1. Once a question and the phone number display on screen, people can start sent SMS to vote their favorite contestant through their mobile phone
2. my system need a Nokia model 8210 which connected to my laptop with infra-red interface
3. when the nokia 8210 receive a vote then it will tranfer the vote into my laptop.
4. then the system will do some process and display a chart
my problem is how do i code the vote count convert to a chart ? and anyone can suggest web-site to me as referance ?
Hope u all can help me on this. Thanks
|
|
|
|
|
You can draw it yourself, or you can use a charting library. There are some good, free ones in .NET.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
well, meaning that i have to used VB.Net to code, is it ?
|
|
|
|
|
Well, seeing as you asked in the VB forum, I guess you'd choose VB to code it, yes.
If you're using VB6, you can still draw this stuff yourself. GDI+ makes it easier, tho.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
<br />
Public Const RAS_MAXENTRYNAME As Integer = 256<br />
Public Const RAS_MAXDEVICETYPE As Integer = 16<br />
Public Const RAS_MAXDEVICENAME As Integer = 128<br />
Public Const RAS_RASCONNSIZE As Integer = 412<br />
Public Const ERROR_SUCCESS = 0&<br />
<br />
Public Type RasEntryName<br />
dwSize As Long<br />
szEntryName(RAS_MAXENTRYNAME) As Byte<br />
End Type<br />
<br />
Public Type RasConn<br />
dwSize As Long<br />
hRasConn As Long<br />
szEntryName(RAS_MAXENTRYNAME) As Byte<br />
szDeviceType(RAS_MAXDEVICETYPE) As Byte<br />
szDeviceName(RAS_MAXDEVICENAME) As Byte<br />
End Type<br />
<br />
Public Declare Function RasEnumConnections Lib "rasapi32.DLL" _<br />
Alias "RasEnumConnectionsA" (lpRasConn As Any, lpcb As Long, _<br />
lpcConnections As Long) As Long<br />
Public Declare Function RasHangUp Lib "rasapi32.DLL" Alias _<br />
"RasHangUpA" (ByVal hRasConn As Long) As Long<br />
Public gstrISPName As String<br />
Public ReturnCode As Long<br />
<br />
|
|
|
|
|
It declares some constants, types, and methods from the windows api "rasapi32"
RAS was to do with interacting with a modem (can't remember what it actually stands for .. Remote Access S.... maybe)
RasEnumConnections - I would guess this enumerates all the currently open connections
RasHangUp - I would imagine this hangs up a given connection.
www.pinvoke.net for more info.
|
|
|
|
|
hello
iam new to .net
i am working with treeview
iwant to generate a binary structure in treeview in the form one parent and two children and so on..............
code for the first node .......
treeview1.nodes.add(xxx)
and for the children.....
treeview1.nodes(0).nodes.add(xxx)
treeview1.nodes(0).nodes.add(xxx)
and for the next....
treeview1.nodes(0).nodes(0).nodes.add(xxx)
treeview1.nodes(0).nodes(0).nodes.add(xxx)
and so on..............
is there any chance of looping them then how
plz any one can helpme?.....
mamatha
-- modified at 6:48 Wednesday 4th January, 2006
|
|
|
|
|
HI,
I AM CREATING A PARENT NODE THEN CHILD FROM DATABASE.
FOR THAT I HAVE USED 2 DATASET AND 2 SQL STATEMENTS.
'***************Adding Root Node**********************
TreeView1.Nodes.Add("PARENT")
'*********************End*****************************
'***************Adding Child Node*********************
For i = 0 To ds1.Tables(0).Rows.Count - 1
Dim ndNodes As TreeNodeCollection, ndNode As TreeNode
ndNodes = Me.TreeView1.Nodes
For Each ndNode In ndNodes
ndNode.Nodes.Add("" & ds1.Tables(0).Rows(i)(0) & " " & ds1.Tables(0).Rows(i)(1) & "")
Next
'******************End*****************************
'***************Adding Sub Child Node**************
Dim temp1 As String = ds1.Tables(0).Rows(i)(0)
Dim sql2 As String = "SELECT a,b,c FROM xyz"
adpt2 = New OleDbDataAdapter(sql2, conn)
adpt2.Fill(ds2, "TPSAT")
For j = 0 To ds2.Tables(0).Rows.Count - 1
Dim ndNodes1 As TreeNodeCollection
ndNodes1 = Me.TreeView1.Nodes(0).Nodes
ndNode = Me.TreeView1.Nodes(0).LastNode
ndNode.Nodes.Add("" & ds2.Tables(0).Rows(j)(0) & " " & ds2.Tables(0).Rows(j)(1) & "")
'***************************************end*****************************************************************
Paritosh
|
|
|
|
|
hi,
thanks for the faster reply
but it is not exactly what i want
i want the tree to be in a binary format
1
.
....2..
.*****....4..
.*****....5..
.
....3..
******....6..
******....7..
and so on
and iam taking only one table ok
thanks in advance
-- modified at 7:41 Wednesday 4th January, 2006
|
|
|
|
|
First a disclaimer: to understand recursion you must first understand recursion
You want to add X number of nodes, each with 2 children and you want this to go for Y depth?
We will:
Call X - topLevelNodeCount
Call Y - treeDepth
Simply drop a tree view on the form named "treeView" and pase this code in your form
<code><pre>int topLevelNodeCount = 3;
int treeDepth = 5;
protected override void OnLoad(EventArgs e)
{
for(int i = 0;i<topLevelNodeCount;i++)
{
TreeNode newNode = new TreeNode("Top" + i);
this.treeView.Nodes.Add(newNode);
this.AddBinaryNode(newNode,1);
}
base.OnLoad (e);
}
private void AddBinaryNode(TreeNode parent, int depth)
{
// add 1
parent.Nodes.Add(parent.Text + "_Child1");
// add 2
parent.Nodes.Add(parent.Text + "_Child2");
if(depth < treeDepth)
{
int newDepth = depth+1;
AddBinaryNode(parent.Nodes[0],newDepth);
AddBinaryNode(parent.Nodes[1],newDepth);
}
}</pre></code>
-- modified at 8:49 Wednesday 4th January, 2006
|
|
|
|